Jump to content

File uploading problem in php..???


ED!T

Recommended Posts

I have tried to upload a file using php. The code was

-uploadfile.php-

 

<?php

if(isset($_POST['upload'])){

include("form_upload.inc");

}

else{

if($_FILES['pix']['temp_name']=="none"){

echo "Files didn't successfully uploaded.

";

include("form_upload.inc");

exit();

}

if(!ereg("image",$_FILES['pix']['type'])){

echo "File is not a picture

";

include("form_upload.inc");

exit();

}

else{

$destination="F:/Installed\/Xampp/xampp/htdocs/test/upload".$_FILES['pix']['name'];

$temp_file=$_FILES['pix']['name'];

move_uploaded_files($temp_file,$destination);

echo "<p> file uploaded successfully

{$_FILES['pix']['name']}

({$_FILES['pix']['size']})</p>";

}

}

 

?>

 

And I create an interface in an include file call 'form_upload.inc'

 

<html>

<head><title>File Upload</title></head>

<body>

<p>Enter the name of the picture</p>

<div align="center"><form enctype="multypart/form-data"

action="uploadFile.php method=POST">

<input type="hidden" name="MAX_FILE_SIZE" value="500000">

<input type="file" name="pix" size="60">

<p><input type="submit" name="Upload"

value="Upload Picture">

</form>

</body>

</html>

 

interface is working but uploaded image is not at the particular destination, "F:/Installed\/Xampp/xampp/htdocs/test/upload".

I have set "upload_tmp_dir=" in php.ini to the destination address.

 

but when I upload "object not found" error occurred...

 

PLEASE HELP ME ......!!!!!!!!!!

Link to comment
https://forums.phpfreaks.com/topic/181110-file-uploading-problem-in-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.