1. missing 13; upload script

I'm struggling with an upload CGI script. (Again.) 

The problem is rather strange... I collect the input with get_bytes(0,i) but the
returned sequence sometimes misses some 13 bytes from the file part. What is
going on? Any idea?

Thanks in advance!

Salix

new topic     » topic index » view message » categorize

2. Re: missing 13; upload script

Salix wrote:
> I'm struggling with an upload CGI script. (Again.) 
> 
> The problem is rather strange... I collect the input with get_bytes(0,i) but
> the returned sequence sometimes misses some 13 bytes from the file part. What
> is going on? Any idea?

Be careful to upload binary files using the BINARY option (not ASCII)
in your FTP program. Otherwise you might have 13 10 (i.e. CR LF)
character combinations converted to just a 10.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

3. Re: missing 13; upload script

Actually I'm experimenting with HTTP. The upload is started with a
multipart/form-data HTML FORM. I tested it with Opera and Abyss webserver. I
parse the input but does not replace {13,10} with {10} but it simply skips 13
sometimes. (But not all 13 bytes!)
Eg. some sequence parts:
s1[i1..i2]={10,12,20,13,12,11,11}
s2[i1..i2]={10,12,20,12,11,11,12}


The way I found this problem was comparing the original and the uploaded JPG
byte by byte. I am clueless. Should be something really obvious...

Regards,

Salix

Robert Craig wrote:
> 
> Salix wrote:
> > I'm struggling with an upload CGI script. (Again.) 
> > 
> > The problem is rather strange... I collect the input with get_bytes(0,i) but
> > the returned sequence sometimes misses some 13 bytes from the file part.
> > What
> > is going on? Any idea?
> 
> Be careful to upload binary files using the BINARY option (not ASCII)
> in your FTP program. Otherwise you might have 13 10 (i.e. CR LF)
> character combinations converted to just a 10.
> 
> Regards,
>    Rob Craig
>    Rapid Deployment Software
>    <a href="http://www.RapidEuphoria.com">http://www.RapidEuphoria.com</a>

new topic     » goto parent     » topic index » view message » categorize

4. Re: missing 13; upload script

From get_bytes  notes:


   include get.e


              
              integer fn
              fn = open("temp", "rb")  -- an existing file
              
              sequence whole_file
              whole_file = {}
              
              sequence chunk
              
              while 1 do
                  chunk = get_bytes(fn, 100) -- read 100 bytes at a time

                  whole_file &= chunk        -- chunk might be empty, that's ok
                  if length(chunk) < 100 then
                      exit
                  end if
              end while
              
              close(fn)
              ? length(whole_file)  -- should match DIR size of "temp"


Does this happen ? size match I mean.
Don Cole

new topic     » goto parent     » topic index » view message » categorize

5. Re: missing 13; upload script

As far as I see your code has not much to do with my problem. 
In my case a file uploaded by an HTML FORM and saved by an EU 
CGI script running under windows differs from the original 
binary file. Your code can check a file read by get_byte and
saved by a local EU script to the original binary file. 

My problem may come from the unique STDIN handleing in Euphoria. 
But I am not sure at all. {:-.

Salix

don cole wrote:
> 
>  From get_bytes  notes:
> 
> [...]
> Does this happen ? size match I mean.
> Don Cole

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu