Activity Stream
48,167 MEMBERS
61271 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 9 of 9
  1.     
    #1
    Member

    Default CURL - postfields how to replicate these headers

    Code: 
    -----------------------------30870195987994
    Content-Disposition: form-data; name="file[]"; filename=""
    Content-Type: application/octet-stream
    
    
    -----------------------------30870195987994
    Content-Disposition: form-data; name="file[]"; filename="K43TA206.zip"
    Content-Type: application/zip
    So I'm trying to write a basic curl upload script for bitshare. I know there is a rapidleech plugin for it, but I'm just wondering how do I pass the empty file as a post field. Bitshare is weird in that they post an empty file array in their header. If I leave it out, the upload does not work.

    In the rapidleech plugin, they open a socket and literally just paste that exact section. For curl I pass in an array format usually.

    array ( "file[]" => "@$filename");

    I've tried

    PHP Code: 
    array ( "file[]" => """file[]" => "@$filename
    But it doesn't work. Any help would be appreciated.
    futureawesome Reviewed by futureawesome on . CURL - postfields how to replicate these headers -----------------------------30870195987994 Content-Disposition: form-data; name="file"; filename="" Content-Type: application/octet-stream -----------------------------30870195987994 Content-Disposition: form-data; name="file"; filename="K43TA206.zip" Content-Type: application/zip So I'm trying to write a basic curl upload script for bitshare. I know there is a rapidleech plugin for it, but I'm just wondering how do I pass the empty file as a post field. Bitshare is weird in that Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    Website's:
    tehMoviez.com 0Senes.com GeekFaceGames.com
    try
    PHP Code: 
    "file[]=&file[]={@$filename}" 

  4.     
    #3
    Member
    Website's:
    ExploringPC.com DedicatedSeedboxHosting.com
    Quote Originally Posted by jokerhacker View Post
    try
    PHP Code: 
    "file[]=&file[]={@$filename}" 
    That one should be working. Have you tried it?

  5.     
    #4
    Respected Developer
    you have to send 2 variables in your post array, one with filename and other with location, here is example for bitshare.

    PHP Code: 
                  $postData = array(
                        
    'APC_UPLOAD_PROGRESS' => $progress_key,
                        
    'APC_UPLOAD_USERGROUP' => $usergroup_key,
                        
    'UPLOAD_IDENTIFIER' => $progress_key,
                        
    'file[]"; filename="' => basename($filelocation),
                        
    'file[]' => $filelocation
                        
    ); 
    Bots Development | Web Development | Wordpress Customization | PSD Conversion

    Life has many twists and turns in it, you have to take what you are given and use it for the best.

  6.     
    #5
    Member
    Quote Originally Posted by jokerhacker View Post
    try
    PHP Code: 
    "file[]=&file[]={@$filename}" 
    Do I append this to the postdata array?

    Quote Originally Posted by mRAza View Post
    you have to send 2 variables in your post array, one with filename and other with location, here is example for bitshare.

    PHP Code: 
                  $postData = array(
                        
    'APC_UPLOAD_PROGRESS' => $progress_key,
                        
    'APC_UPLOAD_USERGROUP' => $usergroup_key,
                        
    'UPLOAD_IDENTIFIER' => $progress_key,
                        
    'file[]"; filename="' => basename($filelocation),
                        
    'file[]' => $filelocation
                        
    ); 
    What happens to the usual @ infront of the file?

    Thanks for your suggestions!

    EDIT: I've tried what mRaza suggested and this is the headers returned from CURL.

    Code: 
    HTTP/1.1 100 Continue HTTP/1.1 200 OK Server: nginx/0.8.50 Date: Wed, 24 Aug 2011 02:38:25 GMT Content-Type: text/html Transfer-Encoding: chunked Connection: close X-Powered-By: PHP/5.3.0 no files

  7.     
    #6
    Member
    Website's:
    tehMoviez.com 0Senes.com GeekFaceGames.com
    Do I append this to the postdata array?
    don't append it, put it the place of the post array

  8.     
    #7
    Member
    Oh so in the form of a GET?

    So when i post with just
    PHP Code: 
    $post "file[]=&file[]={@$x}"


    The header returned is:
    Code: 
    HTTP/1.1 200 OK Server: nginx/0.8.50 
    Date: Wed, 24 Aug 2011 03:34:12 GMT 
    Content-Type: text/html 
    Transfer-Encoding: chunked 
    Connection: close 
    X-Powered-By: PHP/5.3.0  
    
    wrong parameter count
    So when I post with the required fields:
    PHP Code: 
    $post "APC_UPLOAD_PROGRESS={$progress_key}&APC_UPLOAD_USERGROUP={$usergroup_key}&UPLOAD_IDENTIFIER={$progress_key}&file[]=&file[]={@$x}"
    The header returned is:
    Code: 
    HTTP/1.1 200 OK
    Server: nginx/0.8.50
    Date: Wed, 24 Aug 2011 03:38:07 GMT
    Content-Type: text/html
    Transfer-Encoding: chunked
    Connection: close
    X-Powered-By: PHP/5.3.0
    
    
    Notice: Undefined index: file in /var/www/fs/x/upload.php on line 18
    no files

  9.     
    #8
    Respected Developer
    Quote Originally Posted by futureawesome View Post
    What happens to the usual @ infront of the file?
    you have to add @ in file location:
    PHP Code: 
                  $postData = array(
                        
    'APC_UPLOAD_PROGRESS' => $progress_key,
                        
    'APC_UPLOAD_USERGROUP' => $usergroup_key,
                        
    'UPLOAD_IDENTIFIER' => $progress_key,
                        
    'file[]"; filename="' => basename($filelocation),
                        
    'file[]' => "@$filelocation"
                        
    ); 
    Bots Development | Web Development | Wordpress Customization | PSD Conversion

    Life has many twists and turns in it, you have to take what you are given and use it for the best.

  10.     
    #9
    Member
    Website's:
    tehMoviez.com 0Senes.com GeekFaceGames.com
    Oh so in the form of a GET?
    follow mRAza's instructions, it should work.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. how to add Expires headers - Help !
    By prateek in forum Web Development Area
    Replies: 7
    Last Post: 1st Apr 2012, 03:46 PM
  2. Need Logo and Headers for theBangBros.org [PAID]
    By dawinet in forum Graphics Area
    Replies: 13
    Last Post: 13th Mar 2012, 12:18 PM
  3. Http headers php script!
    By inside7 in forum Web Development Area
    Replies: 1
    Last Post: 11th Nov 2011, 12:48 PM
  4. OVH UK - Kernel Headers
    By EvilGenius in forum Technical Help Desk Support
    Replies: 0
    Last Post: 1st May 2011, 02:55 PM
  5. Adding Expiry Headers
    By EnCiPh3r in forum vBulletin
    Replies: 3
    Last Post: 20th Jan 2011, 07:41 AM

Tags for this Thread

BE SOCIAL