User executing the script (www-data or nobody or some other user) has to
vave the permission to wotk with this directory.



Brona


> I am getting this error once i run the script
>
> Warning: move_uploaded_file(img/matrix.jpg): failed to open stream:
> Permission denied in /blah/blah
> Do i need to set the chmod of the img folder?
>
> Cheers
> Paul
>
>
> "Nathan Taylor" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> There is nothing special to be done with the form itself for it to support
> file uploading aside from supply a browse field:
>
> <input type="file" name="file">
>
> As for uploading it, here's some untested code:
>
>  if(!empty($_FILES['file']['tmp_name'])) {
>      $name = strtolower(eregi_replace('#| |\?|!', '',
> $_FILES['file']['name']));
>      $destination = 'path/to/where/you/want/the/file/saved/'.$name;
>      if(move_uploaded_file($_FILES['file']['tmp_name'], $destination)) {
>       echo 'Successful';
>      } else {
>       echo 'Failed';
>      }
>   }
>   ----- Original Message -----
>   From: PAUL FERRIE
>   To: [EMAIL PROTECTED]
>   Sent: Saturday, November 22, 2003 2:04 PM
>   Subject: [PHP] Form with browse for file to upload "ftp"
>
>
>   Getting bit of a regular on here :)
>
>   I am hoping that someone can point me to a script that allows
> me to attach
> a
>   file to be uploaded to a set dir.
>   I have already got the form built, except for a browse file option.
>   The form is part of this admin area
>   http://thor.ancilenetworks.co.uk/~pferrie/vinrev/adm/myadmin.html
>   Instead of having a textfield displaying a url of the image and
> the admin
>   having to upload it sepratly i thought that i could get the admin to
> upload
>   the image via the form.  keeps it altogether.
>
>   I wouldnt know were to begin adding this to the form.  i am pretty sure
>   there a pre-built script that can do this.  Can someone point me to one.
> i
>   had a quick look but came up with very little.
>
>   Cheers
>   Paul
>
>   --
>   PHP General Mailing List (http://www.php.net/)
>   To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to