Reading binary files

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hayunna
Forum Newbie
Posts: 2
Joined: Fri Jan 16, 2009 3:22 am

Reading binary files

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Reading binary files

Post 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.
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: Reading binary files

Post by Mark Baker »

I'm quite intrigued by non-binary versions of excel and word files
hayunna
Forum Newbie
Posts: 2
Joined: Fri Jan 16, 2009 3:22 am

Re: Reading binary files

Post 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.
Post Reply