Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.