Help needed uploading image files ( 0kb issue )

Sarah Reichelt sarah.reichelt at gmail.com
Thu Sep 15 21:37:26 EDT 2005


On 9/16/05, kevin at stallibrass.com <kevin at stallibrass.com> wrote:
> I'm writing a small app to allow a collegue to easily update a web page. In
> it's simplest form, there is one text box and one image to be changed.
> I'm handling the text changes by inserting a javascript include script on
> the web page and using this app to modify the text file it points to. The
> files are updated by using:
> put "document.write('" & fld "newtext" &"');document.write"into URL
> "ftp://name:password@ftp.website.com/thefile.js"
> 
> This works fine, the problem comes with the images. My app imports any image
> file and resizes it to fit the area available on the web page. I can use
> 
> export image "image1" to file "image1.gif" as GIF  -- This works fine to
> create the required file within the local folder
> 
> my problem is getting the image to the URL.. I've tried:
> 
>  export image "image1" to URL
> "ftp://name:password@ftp.website.com/image1.gif" as GIF -- The file appears
> but is 0 kb
> 
> --libURLftpUpload URL "image1" to URL
> "ftp://name:password@ftp.website.com/image1.gif"  -- The file appears but is
> 0 kb
> 
> I've also tried variations of  libURLftpUploadFile, and
> 
> --libURLftpUploadFile
> myVariable,ftp://name:password@ftp.website.com/image1.gif"    -- exporting
> the file to a variable first.
> 
> even copying the correctly saved local file but with the same result
> 
> In each case, the file appears where I need it but it's empty - i.e. 0 kb
> 
> The image file I'm creating is correct as I can ftp it up to the site with
> no problems (not a solution I can offer to my collegue)
> 
> I'm obviously missing something fundamental here that I can't stumble on in
> the documentation so any help would be very gratefully recieved

I would save the file to a temporary file locally and then upload it
using libURLftpUploadFile. This has worked fine for me in the past.
For debugging purposes, make a log field and use libURLsetLogField to
show all the logged data in that field. That way you will be able to
see whatever messages your FTP server is giving and that might give
you a clue.

HTH,
Sarah



More information about the Use-livecode mailing list