Wallboy Posted August 15, 2008 Share Posted August 15, 2008 Hello, I'm wondering if it's possible to send a file through post using libcurl without having to use the browse button and manually selecting the file? And also would this only be possible if the file exists on the remote server, or is it possible to access a local drive to grab the file and upload temporarily and send over post? I'm trying to create a script that will automate a form with various text inputs and a I'm stuck on how with files. How can I achieve this? Thanks! Quote Link to comment Share on other sites More sharing options...
ratcateme Posted August 15, 2008 Share Posted August 15, 2008 so do you want the user to upload a file then the server does a cURL request and sends the file the user uploaded to another server? you could do something like example 2 on http://php.net/manual/en/function.curl-setopt.php and change the array to $data = array('file' => '@'. $_FILES['file_form_field_name']['tmp_name']); this would upload the file straight from the tmp file that the file was first uploaded to when it was sent from the user to the first server the only problem is the server on the other end of the cURL transfer will get something like phpcpjNeQ as the file name with no ext. if you need a ext you could move the file the user uploaded to a random place then use it in the cURL transfer then delete it before the script ends Scott. Quote Link to comment Share on other sites More sharing options...
Wallboy Posted August 15, 2008 Author Share Posted August 15, 2008 No, I have a form on MY server that contains text,file inputs. I'm making a script that can submit post values to the form php automatically where it currently gets values from a txt file such as the name and description and then grabs the next line in the txt with the new value and repeats. I was wondering if I would have to upload the files to my server first and then somehow use libcurl to read each of those files and include those in the loop. Or if it was even possible to grab the file on my local computer without using the windows browser(which I don't think is possible?) Quote Link to comment Share on other sites More sharing options...
Wallboy Posted August 16, 2008 Author Share Posted August 16, 2008 Bump Quote Link to comment Share on other sites More sharing options...
Wallboy Posted August 19, 2008 Author Share Posted August 19, 2008 So is this not possible? ??? Quote Link to comment Share on other sites More sharing options...
Wallboy Posted August 21, 2008 Author Share Posted August 21, 2008 Bump Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.