Page 1 of 1

Reading binary files

Posted: Fri Jan 16, 2009 3:53 am
by hayunna
hi everyone,

i am trying to upload a file without having to use html input file object, by reading the file contents using fopen and fread. i do it by outputting the contents of the ordinary file into a hidden html input box, then submit the form using javascript. i do it this way for a purpose.

everything works fine in ordinary files like text file, excel, word, etc., except binary files (tar.gz files for example). how can i treat these binary files as just like other files?

Re: Reading binary files

Posted: Fri Jan 16, 2009 4:18 am
by requinix
That's... not a file upload. It's something completely different.

Are you putting file data straight into the HTML page? That's your problem, HTML's not meant for binary data like that.

There's not a chance that this is the best way to do whatever it is you want. So how about this: you describe what you're really trying to do, what you are and aren't allowed to use, and we see if there's a better way of doing it.

Re: Reading binary files

Posted: Fri Jan 16, 2009 4:45 am
by Mark Baker
I'm quite intrigued by non-binary versions of excel and word files

Re: Reading binary files

Posted: Wed Jan 21, 2009 4:09 am
by hayunna
hi,

tasairis is right. there's no way for me to achieve this. i was just challenged by my superior to eliminate the traditional way of uploading a file. you know, click browse button, locate for a file then submit the form. they didn't want that. anyway, i'll just find another way to do that.


thanks.