2

I am working on a project and I am using my universities server. However, file_uploads is disabled in php.info and I cannot do anything about it. Therefore I cannot use the normal way up uploading files through html.

I was thinking of reading the contents of the file, transferring the text to the server and writing to a file there. My problem, however, is that I do not know how to do this. I need to open a file dialog and the read the content of the file.

I can use a combination of html, php and javascript (I am not very well traversed in the latter). Do you guys have any suggestion?

My last escape would be to write my client in flash and as3, but I want to avoid this if possible as flash is kind of looked down upon here.

1 Answers1

0

Do you have access to a cgi-bin directory or the capability to mark scripts as CGI? You could write the upload handling script in another language (shell script, Perl, etc...) and have that handle the upload, bypassing the PHP restriction.

However, since you say it's just a text file, you could bypass the problem by simply cutting/pasting the file's contents into a <textarea> and submit the form normally. It'd effectively be a file upload, without ever doing a file upload.

Marc B
  • 356,200
  • 43
  • 426
  • 500
  • Thanks for the quick answer. Unfortunately I do not have access to a cgi-bin directory or mark them as CGI. Your second suggestion I could use for now, but since I eventually want other users to upload text files as well it is really not a good solution for me. Is it not possible to open a file dialog and then read the content of the file selected somehow? If not, then I might just write a flash snippet and embedd it in the html. – Benjamin Johansson Aug 30 '11 at 14:19
  • No. File uploads are heavily restricted in browsers, to prevent malicious sites from stealing arbitrary files from the user's computer. Regardless of how you actually trigger an upload, if you're doing with a PHP receiving script, it's not going to work because your server's PHP will disallow the upload. – Marc B Aug 30 '11 at 14:29