TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
kelum p
NA
2
2.4k
convert php code snippet to ASP.NET MVC 5
Dec 17 2015 2:55 AM
I don't have knowledge about PHP , Curently I'm doing asp.net mvc 5 project in that I want to convert following php code snippet to asp.net mvc which is C# programming language.
To do this easily I just did some research and I saw there is tool to do this. which is PHP to ASP.NET Migration Assistant . But its not working at all there for I have to do this manually , really appreciate suggest way to do this
$p1
=
$p2
= [];
if
(
empty
empty
(
$_FILES
[
'id'
][
'name'
])) {
echo
'{}'
;
return
; }
for
(
$i
= 0;
$i
<
count
(
$_FILES
[
'id'
][
'name'
]);
$i
++) {
$j
=
$i
+ 1;
$key
=
'<code to parse your image key>'
;
$url
=
'<your server action to delete the file>'
;
$p1
[
$i
] =
"<img style='height:160px' src='http://path.to.uploaded.file/{$key}.jpg' class='file-preview-image'>"
,;
$p2
[
$i
] = [
'caption'
=>
"Animal-{$j}.jpg"
,
'width'
=>
'120px'
,
'url'
=>
$url
,
'key'
=>
$key
]; }
echo
json_encode([
'initialPreview'
=>
$p1
,
'initialPreviewConfig'
=>
$p2
,
'append'
=> true ]);
basically above PHP Server code
1. processing ajax upload and returns a JSON response.
2. my server action must return a json object containing initialPreview, initialPreviewConfig,
& append.
Reply
Answers (
0
)
Retrieving more than 1000 data from datatable error mvc4
k2 .NET (C# and ASP.net)