Jump to content

[SOLVED] Uploading a file without a file field?


bird_man11

Recommended Posts

Hi i dunno if any one can help but i have a active x control that saves a file to the local hard drive, and with this file i want the file to be uploaded to the server automatically when the use presses submit.

 

I can get the local path to be stored in a variable by running a javascript function but i cannot seem to upload the file.

 

I have tried making a hidden file box and passing the value to it but it keeps passing a black value to the upload php script. is there anyway to have a $_POST variable used in a upload script?

 

any suggestions?

this is my upload code

  	
                 $filename = $_POST['filename'];

                 $target_path = 'upload/'; // the directory for the original file
	 $prefixbig = '.OMA'; // the prefix to be added to the original name
	 $target_path = $target_path . $id_no . $prefixbig; 
	 $temp = $_FILES['filename']['tmp_name'];

	 if(move_uploaded_file($temp, $target_path)) {
    		          echo "The file ".$temp." has been uploaded";
	 } else{
     		          echo "There was an error uploading the file, please try again!";
		 }

Archived

This topic is now archived and is closed to further replies.

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