Jump to content

file upload


syntax101

Recommended Posts

WHEN I RUN THIS IT CAN UPLOAD A FILE

 

<?php

 

if (is_uploaded_file($_FILES['Filedata']['tmp_name'])) {

 

$uploadDirectory = "d:\\xampp\htdocs\\trip\\";

$uploadFile = $uploadDirectory . basename($_FILES['Filedata']['name']);

 

copy($_FILES['Filedata']['tmp_name'], $uploadFile);

 

}

?>

but when i try it to change to localhost it doest work

 

what is wrong with this code

 

<?php

 

if (is_uploaded_file($_FILES['Filedata']['tmp_name'])) {

 

$uploadDirectory = "http://localhost/trip/";

$uploadFile = $uploadDirectory . basename($_FILES['Filedata']['name']);

 

copy($_FILES['Filedata']['tmp_name'], $uploadFile);

 

}

?>

Link to comment
https://forums.phpfreaks.com/topic/82874-file-upload/
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.