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!";
		 }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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