26 (edited by statiic 2006-04-29 4:49:27 PM)

Re: File Uploading - A possible attempt

It does make you able to upload an file. Without refreshing your page. It runs an backend upload page. And the javascript checks how far the upload is and gives you the message: Uploading... or Upload done.
Its also checks on some errors.

This is ajax based. So it makes use of javascript and an php class. If you guys can make it in the xajax library. That should be great.

Its is also possible to create multiple uploads. By just adding an new upload function with an new id.

Re: File Uploading - A possible attempt

yes, but its not quite there.  there are a few things with it that make it a little too specific for your own code.  i'm looking at making it work for anyone whether they have already got a <form> tag open, thus allowing anyone to put the file input wherever they like.

the link above uses one of two javascript functions to override the current file input's in the page, either at creation time, or dynamically, and i'll be looking at extending that to put into an xajax plugin.  your code does have some interesting ideas that i may end up using though smile

28 (edited by statiic 2006-04-29 5:01:38 PM)

Re: File Uploading - A possible attempt

Ah I see.
Then I will just be patient until you found an solution for this.

Cause I need the upload function for my business website. My clients should be able to upload some files to me.

I will be on vacation anyway for an week from now. So Good luck with it and I hope you found an solution when I'm back wink LOL

Re: File Uploading - A possible attempt

hmm... *thinking aloud* perhaps instead of using perl cgi, is it possible to use php cgi (ok not installed on everyones machine, but could be on a couple and it's php not perl) to do the progressbar?

Re: File Uploading - A possible attempt

Why using cgi. With javascript its possible to create an progressbar too. No need for cgi here.

Re: File Uploading - A possible attempt

progress bar as in 10% uploaded, 100kb out of 350kb etc

Re: File Uploading - A possible attempt

Yes this is possible with php and javascript only.

BUT then you have to patch your apache/php config files.

So you have to decide between 2 hard ones. Or installing CGI or patching php config files.

Both of them are too sloppy for just an progress bar. Better use it without the bar for now and the text only.
But thats my opinion.

Re: File Uploading - A possible attempt

is it too much to assume that people who use php on their webservers, also have the command line/binary executable for php?  i'm still pondering trying to use cli/cgi php to process the uploading file content

Re: File Uploading - A possible attempt

LOL. I got it, but I just know from experience that a lot of people wont have it.

So no problem for me wink

Anyway. I found something interesting for you. If you want to use cgi scripts.

This script is already using cgi. Ony its based on prototype.js so maybe you can do something with it.
http://tomas.epineer.se/tesupload/

Re: File Uploading - A possible attempt

yes. but that uses perl cgi scripts.  as Jared said earlier in this topic, we'll keep away from perl in xajax.
which is why i'll try using php cgi scripts.

Re: File Uploading - A possible attempt

I've found a way to monitor if an upload is busy, simply by setting an session variable to true or false. With a timeoutfunction keep on checking until the session variable is switched off. I think it will not be possible to monitor the progress live, because PHP doesn't give any reply while processing the upload.
I've tried to manage it, with getting the filesize of the tmp file, but the problem is, you don't know the tmp filename. I've seen an implementation which get's the whole tmp dir but i guess that's not desirable.

If somebody has a way to get the tmp filenames from the files you are uploading, then we have the solution!

Re: File Uploading - A possible attempt

hey take a look at this trick:

http://the-stickman.com/web-development … e-element/

It uses multiple file inputs hiding them at first so that the user can select various files. Something like that would be cool wink

Re: File Uploading - A possible attempt

Any updates on this feature?

Re: File Uploading - A possible attempt

iandc76, yes and no smile
Yes, you can do file uploads easily, but still no ideas for how to get the progress bar to work (and I still havn't tried using a PHP CGI script)
The file upload example posted above works, it just has no feedback.

My biggest question, is how should regular file-upload input boxes be converted into xajax powered ones?

Re: File Uploading - A possible attempt

Post above???

Your file upload doesnt seem to work correctly BBC. It doesnt give the status that the upload is finished.
Anyway. The post I made in the vanity board with the download link. That one does work.

So for now thats the only working file upload for now I think (without the progress bar offcourse).

Re: File Uploading - A possible attempt

statiic wrote:

It doesnt give the status that the upload is finished.

I wrote:

The file upload example posted above works, it just has no feedback.

Quite right

Re: File Uploading - A possible attempt

LOL. Thats what you ment with it.

You can better use the one I posted in the vanity board then wink

Hope you get the http streaming working soon. So I can make an update on it.

Thx

43 (edited by CtRiX 2006-05-25 10:46:08 AM)

Re: File Uploading - A possible attempt

This approach after heavy changes is working for me.
I hope I will have some time to clean the code and give some links.

Anyway, I'd like to point out that With safari this approach does not work (at least on OSX 10.3.X) because Safari (and konqueror) have problems with Iframes when dynamically created.

So, compatibility is with IE and Firefox (all platforms) and Camino (OSX).

Update: opera 8.54 does not work

Re: File Uploading - A possible attempt

Hi CtRiX if you sorted out the code. Can you please post it here. Or send us an link where we can download the scripts.

Re: File Uploading - A possible attempt

Once I set up my file input box in a form and xajax-ify it, where can I grab the data that has just been uploaded? Also, how do I check to see if the file is done being uploaded?

In my case I am trying to have a user select an image, then once its uploaded, have it entered into the database and then update a section of my html to display the new image.

Also, on your example, it doesn't seem to be working with Firefox and Safari (both on a mac). After the file uploads, the place where the file form used to be has been replaced with what looks like the entire page but in a very small area.

Thanks for all your awesome work, you've made my job much easier smile
Alex

Re: File Uploading - A possible attempt

(Sorry for my bad English)
Hello,
I'm trying to use XAJAX file upload, it's works well (as on example).
Can it possible to make such as (multiple files inputs):

<form name="submit_form"> 
  <input type="file" name="image" /><input type="button" value="Add" onClick="xajax_add_file(`...add new file input...`)" /><input type="button" value="Remove" onClick="xajax_remove_file(`...remove file input...`)" />
  <input type="button" value="Sent data!" onClick="xajax_post_data(`...transfer form data...`)" />
</form>

So, when file selected, then it's uploading to the server (and insert into database, for example).
When user click on button "Add", after first file input inserting new file input etc.
When user click on button "Remove", this file input removed (from the server).
Thsnks!
(Sorry for my bad English)

Sorry for my bad English

Re: File Uploading - A possible attempt

Since I last posted I've been doing a little work on getting a progress bar going.

I'm really happy to say that I'm almost at a breakthrough, using a PHP CGI script in a similar way to the perl CGI script mentioned above.  Thus we can have a purely PHP solution to the problem smile

Most likely this will be in xajax 0.5 as a plugin, but I'll release the code when it's all finished smile

Re: File Uploading - A possible attempt

Fine, i'll waiting for it (:

Sorry for my bad English

49 (edited by BigBrownChunx 2006-06-28 12:26:16 AM)

Re: File Uploading - A possible attempt

OK, I have a demo that uses a PHP cgi script and shows the progress of the upload using xajax.

While I'm at work (2100-0500 UTC) you can view it at:
http:///file_upload_test.php
(just had to remove the link since its not running on my server anymore)

There are, naturally, a couple of bugs.  But for the most part, it works ok.

50 (edited by jsismail 2006-06-19 4:00:25 AM)

Re: File Uploading - A possible attempt

There seems to be a .cgi file named upload.cgi needed for file_upload_test.php demo to work.  It sure looks like it's doing something, but when it gets to what seems to be the end if the upload, I get the missing file error:

"Not Found

Sorry, the requested URL /cgi-bin/upload.cgi?UID=1150685514 was not found on this server."


Am I missing something?


Thanks,
James