Forum Moderators: coopster

Message Too Old, No Replies

image upload with php + AJAX

is it possible image uploading with AJAX

         

zangs

4:48 pm on May 11, 2006 (gmt 0)

10+ Year Member



Hello friends,

I want upload the image using AJAX + PHP..
And i need complete soure code urgently..
if it is possible, help me.

thnx in advance.

whoisgregg

5:57 pm on May 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



WebmasterWorld isn't really the place to look for complete source code for your projects. Perhaps a web search for those terms would be more helpful?

zangs

4:21 am on May 12, 2006 (gmt 0)

10+ Year Member



thnx for advice,

but someone can help that is it possible or not?
if yes how can is start?

again thnx...

eelixduppy

11:50 am on May 12, 2006 (gmt 0)



Since this is a PHP forum, i'll show you how to upload an image with PHP :)

form.html


<form action='process.php' method='post' enctype='multipart/form-data'>
<input type='file' accept='image/png' name='image'>
</form>

process.php


$filedata = $_FILES['image'];
$tempfile = $filedata['tmp_name'];

if(is_uploaded_file($tempfile)) {
$destfile = "/var/www/html/".$filedata['name]; //Linux format

if(move_uploaded_file($tempfile, $destfile)) {
echo "File moved to $destfile";
}
else
{
echo "File cannot be moved to $destfile";
}
} else {
echo "No uploaded file!";
}

Something like this. Hope this helps

eelix