1
HFS ~ HTTP File Server / Re: upload with filename inside URL
« on: April 07, 2009, 01:35:55 PM »thanks for sharing rxr!
on my side, your post made me discover there's a CURL binary for Windows. may be very useful for the future.
Hey! I'm glad the info proved to be of value.
Indeed there is a binary for Windows as well as Linux (and I've tested both and they seem to work just as expected --- note that the command "curl --manual" gets a large text formated file echoed to console that gives some explanation for the many curl options). Here are a few extra little bits of info I've learned on the subject...
1) The curl command shown below without an ending "/" after the <HFSfolder> works better in that it return the "301" code to the console when everything works properly (with an ending "/" you get the echo of the HFS html upload page, the upload still works fine, but having the return code available to any error checking in a script is probably be better). You probably know better than I why there is this slight difference between having the "/" at the end and not having it.
curl -F fileupload1=@MyFile.iso -F press="Upload files" http://<HFSipaddress>/<HFSfolder>
2) I've tested curl ability to take input from stdin via a command, for example, like this:
cat testfile.gz | curl -F fileupload1=@-;filename=atestfile.gz -F press="Upload files" http://<HFSipaddress/<HFSfolder>
and got it to work A-OK. The result was the file being uploaded to HFSfolder and was given the name "atestfile.gz" as expected (note that I'm working from memory and I think the above command was the syntax I used, but using stdin with the filename option to name the stdin file on the HFS server, I did get this to work --- again useful bit of knowledge for those wanting to build cmd scripts to upload files like the original poster was asking about).
3) The last bit of testing I did with curl was with the "-G" option testing if it can be used like "wget" to download from an HFS server --- and if the curl result can be piped to other programs that accept stdin for input (like gunzip) to process. It seems to work A-OK with HFS server and indeed the download can be piped. For example I download the gzip file and piped it to gunzip and got the uncompressed output just as expected.
I'm sure there are more tricks that can be done by those that are more expert in all this than me.
HFS server is a very good program. You should be proud of your work.
Thanks.