i have following form in html:

<form action="upload_file.php" method="post" enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>

and my upload_file.php is in the following:

    echo "Upload: " . $_FILES["file"]["name"] . "<br>";
  echo "Type: " . $_FILES["file"]["type"] . "<br>";
  echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
  echo "Stored in: " . $_FILES["file"]["tmp_name"];

if i install the wamp in c-drive it access the tmp accurately and upload the file into the folder. but if i install the wamp into d-drive it couldn't work properly. what the problem with this???

Member Avatar for LastMitch

@shahai.ali

if i install the wamp in c-drive it access the tmp accurately and upload the file into the folder. but if i install the wamp into d-drive it couldn't work properly. what the problem with this???

There shouldn't any issue if you upload the file in the folder in a C or D or E drive.

Try to see rather the folder is able to let you upload meaning check if gives you permission to access. You have to understand the default is tmp in Wampp and maybe your script might look for temp instead.

thnx LastMitch for reply. yes i have permission to upload the files. and the default is tmp i have set it using php.ini

Member Avatar for LastMitch

@shahai.ali

yes i have permission to upload the files. and the default is tmp i have set it using php.ini

Then I think it has to do with your code not with WAMP, you have to set the path from that folder to your code.

what was the full path to the tmp folder in your php.ini? from my own confi file i have this

;upload_tmp_dir = which means am using the system temp folder

so if am not on C: drive then i can create a folder call tmp on D: drive and change the path to

upload_tmp_dir = D:/tmp

and good idea is to use php and get the system default path and from there you know where your WAMP is place the uploaded file e.g

$temp_file = sys_get_temp_dir();
echo $temp_file;`

hope this helps

all the stuff i have done already thnx you all MASTERS...the problem was there in php.ini i have set the upload limit from:
; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 2M

to the following limit:

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 50M

all other php stuff was working accurately.
thnx you all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.