News:

Join the Facebook Fan Page.

Main Menu

A better upload system

Started by simon36, April 09, 2012, 01:29:10 PM

Previous topic - Next topic

simon36

IPB handles picture uploads much better. You browse to the image you want and select it and upload it there and then whilst keeping the post form open.

This way when the user comes to submit the post there is less stress on the server as all images are not uploaded and handled at the same time.

Secondly, you need to actually re-size images to the board dimensions so that they take up less server space.

simon36

Any thoughts about this? Users find the uploads complicated and there is a better way of handling it.

Kindred

#2
well, I'm not sure that "there is a better way of handling it" is correct...   it is your preference to the way of handling it (just because some other software does something does not make it "imperative" that SMF do it the same way.)

Also, "users find uploads complicated" is not really descriptive (nor is it necessarily true, since I have not ever received any questions or complaints about it on the several forums that I run, including one with 40,000 members)
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

IchBin™

Perhaps describing the features you think SMF lacks, or the features you would like to see in detail would help. Most people around here have no idea how IPB handles attachments. So describe in detail so others can weigh in on your proposal.
IchBin™        TinyPortal

emanuele

I think what he is suggestion is to change "a bit" the logic of the attachments: instead of having the attachments attached all at the same time when the "post" button is pressed, he is suggestion to actually upload (by ajax I'd say) the attachments the moment they are selected.

I'm not sure if I explained it properly, let's make an example:
1) "reply"
2) write a bit of text
3) attach a file (in background the attachment is uploaded to the server and processed)
4) you continue to write your text
5) attach a new file (in background the attachment is uploaded to the server and processed)
6) press "post"
7) the post is processed, the attachments are already uploaded and only database actions are necessary.


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

nend

What if you press post and the upload is still going? Maybe add a event listener that fires off when the upload is completed. The form will have to wait though for that even listener before it can submit its data.

I been playing though with HTML5's new stuff and last week I believe I started playing with the new features in XMLHttpRequest. Will basically made a form with a progress bar with nominal amount of code edits. Server doesn't have to report the status anymore, allot easier now days, lol.
http://dev.siserver.us/javascript/html5-upload-progress-bar/

IchBin™

What if you attach something but don't finish posting?
IchBin™        TinyPortal

emanuele

Quote from: nend on May 08, 2012, 10:32:11 AM
What if you press post and the upload is still going? Maybe add a event listener that fires off when the upload is completed. The form will have to wait though for that even listener before it can submit its data.
Of course mine was just an explanation, not an implementation. :P


Take a peek at what I'm doing! ;D




Hai bisogno di supporto in Italiano?

Aiutateci ad aiutarvi: spiegate bene il vostro problema: no, "non funziona" non è una spiegazione!!
1) Cosa fai,
2) cosa ti aspetti,
3) cosa ottieni.

butch2k

As a side note i managed to code an ajaxified version of the attachment dialog along with multiple drag/drop and copy/pasting. It was no easy task believe me... and it works from IE6 up to chrome.

Here is a quick summary of the issues encountered and the way i dealt with them, maybe it could be of help if someone go through the same stuff.

One of the main issues i encountered was maintening a coherent state whenever an error occurs on submit. Indeed, as designed in SMF, the internal message ids change whenever the post page is refreshed, so you can't rely on this to identify the message to which the attachments are being attached. Remember that at creation time, messages do not have an id yet, so in the attachment table ajax uploaded files are attached to message with id 0.

So i designed an uuid which is carrying over even when the dreaded "someone else posted before you submitted" or "you forgot the subject" error messages appear. Files are uploaded linking to message with id=0 and an uuid (extra column on the attachment table). At submission time in the post2 function (iirc) i update the attachments linked to the uuid i carried over when posting and attach them back to the message id which now exists.

You also need to add some cleanup code to the unload event in case the poster cancels his post after uploading some files.

The code is mixed with some of the ILA mode so clicking on the thumbnail or filename insert either an attach= or attachmini= tag, shift clicking on the thumbnail insert an attachimg tag.

I relied as much as possible on the existing codebase, so i use mostly unmodified versions of the create and remove attachment functions and logic.


butch2k

I attached a cleanup code to the onbeforeunload event (not on the on unload which is not entirely reliable). Moreover there is a timestamp column added to the attachments table and a batch running every night removing dangling attachments.

One issue with the cleanup code is that you can't rely on an async call, you need an ajax sync call else you request might get cancelled before it execute. I'm actually testing fast synchronous calls using Gearman workers to do the job asynchronously after sending the delete request synchronously.

Akyhne

I posted about a possible solution for this a while ago in the friends board.

The reason was that I discovered, it only needs one or two small changes when pressing "Preview" to also trigger the upload of attached images in the same step. It worked well in a test enviroment.
Norv that was the lead developer on that time, was very interested in this and said he would look into it.

Quote from: IchBin™ on May 08, 2012, 10:52:33 AM
What if you attach something but don't finish posting?
Not a problem. If a file is uploaded but you skip the post, the file will stick there. But... in the upload script of SMF, there's an automatic cleanup method for this. I can't remember how it works, but s I remember the script looks for older files and deletes them if they are more than a week old or so.

And I agree it's quite annoying the SMF software doesn't upload instantly, like other forum software. Reason is, it's quite unstable how it works now and because I wanted to be able to use attached images instantly in a post. That's why I looked into it. I wanted to make a mod out of it. But as Norv was very interested as lead developer, I thought I wouldn't bother making the mod.

Bigguy

Nice idea, would love to see this in SMF. :)

Advertisement: