• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: HTTP POST multipart/form-data?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTP POST multipart/form-data?


  • Subject: Re: HTTP POST multipart/form-data?
  • From: "Daniel A. Shockley" <email@hidden>
  • Date: Tue, 22 Apr 2003 01:33:45 -0400

On 4/11/2003, "Don MacAskill" <email@hidden> wrote:
> >I'm trying to script a batch file upload via HTTP POST using
AppleScript.
>After looking at IE's dictionary, it looked like I could
just use 'OpenURL'
>with a 'MIME Type' of 'multipart/form-data' and be set. (Had to create
>the correctly-formatted 'FormData' of course, but I did that).

> Logically, uploading would be a job, either for URL Access
> Scripting's "upload", or for curl.

OK. First, URL Access Scripting cannot do multipart/form-data to include a file when POSTing. It can only do the standard form POST and GET. Second, you can just have curl save the page that results, and then open that locally in your web browser if you'd like to see the results page. You may need to modify the base URL of the document so images load, but that can be done quickly.
More below:

Sure. :) By scripting Internet Explorer (or even Safari) to do the HTTP
POST instead of cURL, I get a nice response page in IE. I suppose I can
fetch the results from curl and display them in IE, but there are a couple
of other benefits too ('do shell script' is limited to 65000 characters, for
example, and if we're trying to upload a few hundred files, we may run out).

Much safer to store the results to a file - some web pages return characters that cause a data coercion error in do shell script, anyway. A quick way around that is to pipe the curl results through vis, but if you want to see the whole page, just specify a file destination for curl using the --output option. Then you won't run into the character limit.

--
----
Daniel A. Shockley, Database Programmer
MacEasy Computing
email@hidden
email@hidden
email@hidden
http://www.maceasycomputing.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: MS Word Save as TEXT - Newbie
  • Next by Date: Re: Complete newbie
  • Previous by thread: RE: HTTP POST multipart/form-data?
  • Next by thread: Re: getting the user's download folder
  • Index(es):
    • Date
    • Thread