php - uploading image file to same folder -


i got php script file can see code here

<?php     $error = "";     $msg = "";     $fileelementname = 'filetoupload';     if(!empty($_files[$fileelementname]['error']))     {         switch($_files[$fileelementname]['error'])         {              case '1':                 $error = 'the uploaded file exceeds upload_max_filesize directive in php.ini';                 break;             case '2':                 $error = 'the uploaded file exceeds max_file_size directive specified in html form';                 break;             case '3':                 $error = 'the uploaded file partially uploaded';                 break;             case '4':                 $error = 'no file uploaded.';                 break;              case '6':                 $error = 'missing temporary folder';                 break;             case '7':                 $error = 'failed write file disk';                 break;             case '8':                 $error = 'file upload stopped extension';                 break;             case '999':             default:                 $error = 'no error code avaiable';         }     }elseif(empty($_files['filetoupload']['tmp_name']) || $_files['filetoupload']['tmp_name'] == 'none')     {         $error = 'no file uploaded..';     }else      {             $msg .= " file name: " . $_files['filetoupload']['name'] . ", ";             $msg .= " file size: " . @filesize($_files['filetoupload']['tmp_name']);             //for security reason, force remove uploaded file             @unlink($_files['filetoupload']);            }            echo "{";     echo                "error: '" . $error . "',\n";     echo                "msg: '" . $msg . "'\n";     echo "}"; ?> 

using script file not sure uploading image file, want change script upload image same directory in doajaxfileupload.php file is. help?

if want me post code here can post here too.

look here: http://de2.php.net/manual/de/function.move-uploaded-file.php

<?php     if (move_uploaded_file[$fileelementname]['tmp_name'], "./" . $fileelementname)) {        echo "done!";     } else {        echo "fail";        //handle fail        die(); //stop     } ?> 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -