Jump to content

[SOLVED] File upload errors


jeeves245

Recommended Posts

Hey all, another question (I know I know, i'm full of questions).

 

Having some problems uploading a file to my server. I have no issues on my local Apache server, but when I saved the files to my web host's FTP server I get the following errors:

 

Warning: move_uploaded_file(http://www.example.co.nz/folder/uploads/deliveries.csv): failed to open stream: HTTP wrapper does not support writeable connections. in /var/www/html/folder/uploader.php on line 6

 

Warning: move_uploaded_file(): Unable to move '/tmp/phpxmrk5L' to 'http://www.example.co.nz/folder/uploads/deliveries.csv' in /var/www/html/folder/uploader.php on line 6

 

Here is the form code:

 

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose manifest from computer:<br> <input name="uploadedfile" type="file" /><br /><br>
<input type="submit" value="Click here to upload" />

 

And here is the actual code that handles it (uploader.php):

 

<?php $target_path = "http://www.example.co.nz/folder/uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
//more code here but it doesn't related to the errors 
?>

 

 

 

This code should uploaded the file to the /uploads folder. As I said, it worked fine on my local server, just not on my web host.

 

Any ideas appreciated :)

 

Link to comment
https://forums.phpfreaks.com/topic/169523-solved-file-upload-errors/
Share on other sites

<?php $target_path = "./uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
//more code here but it doesn't related to the errors 
?>

try that

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.