Curl - upload multiple attachment arrays to server webpage


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Curl - upload multiple attachment arrays to server webpage
# 1  
Old 04-16-2017
Curl - upload multiple attachment arrays to server webpage

The html page of the form data is as below
Code:
<form name="uploadform" id="uploadform" action="htmlupload.php" enctype="multipart/form-data" method="post">  <table class="tborder" cellpadding="6" cellspacing="1" border="0" width="100%" align="center"> <tr>     <td class="tcat">         Upload Files     </td> </tr> <tr>     <td class="panelsurround" align="center">     <div id="upload" class="panel">         <div style="width:720px" align="left">             <table border="0"><tr>                 <td>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                 </td>                 <td>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                 </td>                 <td>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                     <div><input name="attachment[]" type="file"></div>                 </td>             </tr></table>         </div>         <div style="margin-top:6px">             <input value="6ece14a18366a322c347c71cbfe87420" name="uploadcode" type="hidden" />             <input value="upload" name="do" type="hidden" />             <input value="upload" name="uploadbutton" onclick="onClickVerify();" class="button" type="button" accesskey="s" />             <input type="reset" class="button" value="Reset Fields" accesskey="r" />         </div>     </div>     <div class="panel" id="status" style="display:none;width:100%;">         &nbsp;     </div>     </td> </tr> </table>  </form>

I am trying to post files and upload using the curl command, tried the below two commands
Code:
curl -b cookie.txt -d "attachment[]=@1.png&do=upload" http://f7.masaladesi.com/htmlupload.php curl -b cookie.txt -F "attachment[]=@1.png" http://f7.masaladesi.com/htmlupload.php

The image of the webpage(public one if you are registered)

Please give me a hint on how to achieve this, it is an array of selecting the attachments

---------- Post updated at 10:37 AM ---------- Previous update was at 06:25 AM ----------

Tried with the below command
Code:
curl -b cookie.txt --form "attachment[]=@1.png" --form "do=upload" myurl

But it says "invalid upload" in the resulting webpage. That means the upload button works, something wrong while sending the attachment

---------- Post updated at 10:41 AM ---------- Previous update was at 10:37 AM ----------

Also the webpage is a forum, it is same as clicking on "Manage Attachments" button after create a new thread. You will see an array of Browse button with an ' upload' at the end

Last edited by Don Cragun; 04-16-2017 at 05:40 PM.. Reason: Add missing CODE tags to 1st update.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to get content of a webpage Curl vs Wget?

Hello, What I am trying to do is to get html data of a website automatically. Firstly I decided to do it manually and via terminal I entered below code: $ wget http://www.***.*** -q -O code.html Unfortunately code.html file was empty. When I enter below code it gave Error 303-304 $... (1 Reply)
Discussion started by: baris35
1 Replies

2. UNIX for Dummies Questions & Answers

When downloading a webpage by curl, what happen?

Hello, when im downloading an webpage from command line (CLI) by curl or wget the target website is loaded like i load it from browser? meaning target server connect to database and render data from mysql? Or only static content is downloaded? (2 Replies)
Discussion started by: postcd
2 Replies

3. UNIX for Dummies Questions & Answers

Shell Imgur upload with curl

Hi imgur(){ $*|convert label:@- png:-|curl -F "image=@-" -F "key=1913b4ac473c692372d108209958fd15" http://api.imgur.com/2/upload.xml|grep -Eo "<original>(.)*</original>" | grep -Eo "http://i.imgur.com/*";}Execute a command, convert output to .png file, upload file to imgur.com, then returning... (10 Replies)
Discussion started by: slashdotweenie
10 Replies

4. Shell Programming and Scripting

help to upload multiple files through SFTP

Hi Experts, Please help me to write the expect script for uploading multiple files in one shot . Below is my program that I have written. #!/usr/local/bin/expect -f #/home/kulbhushan/sftp_prog.sh # procedure to attempt connecting; result 0 if OK, 1 otherwise proc connect {passw} { expect... (1 Reply)
Discussion started by: kulbhushan
1 Replies

5. Shell Programming and Scripting

Curl ftp upload success but no file exist on the server !!!!

hello, I'm trying to upload a file to this ftp server and others ftp://ftp.byethost12.com as you can see in the output of CURL using the -v option curl reports that the upload succeeded but when i connected to the server with file-zilla there is no file uploaded the same command upload files... (5 Replies)
Discussion started by: laraaj
5 Replies

6. Shell Programming and Scripting

File upload through curl

hi; I need a script to upload a file using HTTP(curl post) to another system. Will appreciate ur help. Thnks; (0 Replies)
Discussion started by: ajaypadvi
0 Replies

7. Shell Programming and Scripting

upload on server

salmo allim warhmat allah wa brakato i face another problem with ftp protocol i have my server when upload with ftp on my server it upload when access from internet with URL can't find any thing that i get from ftp commend that upload in Current directory is /home/user name when... (5 Replies)
Discussion started by: pua06
5 Replies

8. Shell Programming and Scripting

Shell Script for Upload/download files using cURL

hi please help me out here, i want to use curl command in shell script to test web pages, what i have is an opening page, when i click on a button on opening page, the next page comes up and then i have to upload a file n then click another button to submit and then comes the output page,... (2 Replies)
Discussion started by: Olivia
2 Replies

9. UNIX for Advanced & Expert Users

Issue in Curl to send http POST request with attachment/multipart

Hi, I am using curl to hit a url using http in solaris 10 using commandline, I want to transfer an attachment(using multipart curl -F) also as a part of the request. If anyone has used kindly help me with the syntax. I am using below command: Code: /usr/local/bin/curl -v... (1 Reply)
Discussion started by: manishmaha
1 Replies

10. Shell Programming and Scripting

upload multiple files

i need a javascript html file for uploading multiple files with abitlity to select many files at a time and a cgi-perl script at the back end on server. (0 Replies)
Discussion started by: raksha.s
0 Replies
Login or Register to Ask a Question