Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

upload file error

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

upload file error

Postby DigitalRice » Mon Sep 15, 2003 7:32 am

hi, i'm having trouble of uploading files, it always give me this error.

Warning: move_uploaded_file(http://localhost/gallery/temp/x.new) [function.move-uploaded-file]: failed to create stream: HTTP wrapper does not support writeable connections. in G:\web\gallery\saveFile.php on line 11

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\WINDOWS\php8.tmp' to 'http://localhost/gallery/temp/x.new' in G:\web\gallery\saveFile.php on line 11

why is that?

my upload script is very simply,

form:
Code: Select all

       <form enctype="multipart/form-data" method="post" action="gallery/saveFile.php">
           <input type="hidden" name="MAX_FILE_SIZE" value="5120000">
           Upload image: <input type="file" name="userfile" style="border:1px solid gray;height:20px;">
           <input type="reset" value="Reset" style="border:1px solid gray;">&nbsp;
           <input type="submit" value="Upload File" style="border:1px solid gray;height:20px;">
        </form>

upload script:

<?php
    if ($_FILES['userfile']['tmp_name'] == 0) {
       move_uploaded_file($_FILES['userfile']['tmp_name'], "http://localhost/gallery/temp/x.new");
    }
?>


thanks
DigitalRice
New php-forum User
New php-forum User
 
Posts: 29
Joined: Fri Jun 27, 2003 10:05 pm

Postby Oleg Butuzov » Mon Sep 15, 2003 11:35 pm

problem that you want to move file to webserver using full adress. its imposible. try to use folders =)

Code: Select all
<?php
    if ($_FILES['userfile']['tmp_name'] == 0) {
       move_uploaded_file($_FILES['userfile']['tmp_name'], "temp/x.new");
    }
?>
 
Oleg Butuzov
Last Samuray
Last Samuray
 
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.