Re: Upload_File
| From: | Gunawan Wibisono | Date: | Wed, 10 Feb 2010 11:35:11 +0000 |
| Subject: | Re: Upload_File | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-46867@lists.php.net to get a copy of this message | ||
u should type the error here
and attach the file not type in msgbox below
what permision for upload folder?
On Wed, Feb 10, 2010 at 6:16 PM, Bilal Ahmad <engg.bilalmalik@googlemail.com
> wrote:
> Hi I am trying to make a form to provide option to user to upload a file on
> a server.Here is the code for my upload.php. It checks all the conditions
> etc.. . This code works fine on localhost , and file is uploaded
> successfully. But when I use this script online on my server, it gives me
> error. couldn't figure out what is error.
> What I think is error in move_upload_file, but it isn't returning any
> error.
> File permissions on upload folder are 755.
>
>
>
> if((!empty($_FILES['uploaded_file'])) &&
> ($_FILES['uploaded_file']['error']
> == 0)){
>
> $ok = 0;
> $filename = basename($_FILES['uploaded_file']['name']);
>
> $ext = substr($filename, strrpos($filename, '.') + 1);
>
> if (($ext == "jpg" || "gif" || "png") &&
> ($_FILES["uploaded_file"]["type"]
> == "image/jpeg" || "image/gif" || "image/png") &&
> ($_FILES["uploaded_file"]["size"] < 2097152) ){
>
> $newname = 'upload/'.$filename;
>
> if (!file_exists($newname)) {
>
> if
> ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) {
> $ok = "1";
> echo "It's done! The file has been saved as: ".$newname;
> } else {
> echo "Error: A problem occurred during file upload!"; //This one
> executes when ever i try to upload file on server.
> }
> } else {
> echo "Error: File
> ".$_FILES["uploaded_file"]["name"]." already
> exists";
> }
> } else {
> echo "Error: Only .jpg images under 2MB are accepted for upload";
> }
> } else {
> echo "Error: No file uploaded";
> }
>
> Thanks
> Bilal Farooq Ahmad
>
--
akan ada dimana mulut terkunci dan suara tak ada lagi..
saat itu gunakanlah HP untuk melakukan SMS!!
-> ini aliran bedul.. bukan aliran aneh.
tertawa sebelum tertawa didepan RSJ..