Advertisement:

Author Topic: A better upload system  (Read 12242 times)

Offline simon36

  • Jr. Member
  • **
  • Posts: 111
A better upload system
« on: April 09, 2012, 01:29:10 PM »
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.

Offline simon36

  • Jr. Member
  • **
  • Posts: 111
Re: A better upload system
« Reply #1 on: May 02, 2012, 02:46:26 PM »
Any thoughts about this? Users find the uploads complicated and there is a better way of handling it.

Offline Kindred

  • The Mean One
  • Support Specialist
  • SMF Legend
  • *
  • Posts: 58,423
  • Gender: Male
    • Kindred-999 on GitHub
Re: A better upload system
« Reply #2 on: May 02, 2012, 04:54:14 PM »
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)
« Last Edit: May 02, 2012, 06:22:14 PM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

Offline IchBin™

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,115
  • Gender: Male
  • I don't speak German.
Re: A better upload system
« Reply #3 on: May 02, 2012, 05:04:29 PM »
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
Coding Guidelines       

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: A better upload system
« Reply #4 on: May 08, 2012, 08:55:29 AM »
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.

Offline nend

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,755
  • 2 deep n2 the code
    • sicommnend on GitHub
    • SIComm.us
Re: A better upload system
« Reply #5 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.

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/

Offline IchBin™

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 11,115
  • Gender: Male
  • I don't speak German.
Re: A better upload system
« Reply #6 on: May 08, 2012, 10:52:33 AM »
What if you attach something but don't finish posting?
IchBin™        TinyPortal
Coding Guidelines       

Offline emanuele

  • SMF Super Hero
  • *******
  • Posts: 14,156
  • Gender: Male
  • THERE'S JUST ME
Re: A better upload system
« Reply #7 on: May 08, 2012, 12:26:08 PM »
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.

Offline butch2k

  • Full Member
  • ***
  • Posts: 416
  • Gender: Male
    • @butch2k on Twitter
    • Planète Roliste
Re: A better upload system
« Reply #8 on: November 22, 2012, 07:56:51 AM »
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.


Offline butch2k

  • Full Member
  • ***
  • Posts: 416
  • Gender: Male
    • @butch2k on Twitter
    • Planète Roliste
Re: A better upload system
« Reply #9 on: November 26, 2012, 03:20:38 AM »
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.

Offline Akyhne

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 7,331
Re: A better upload system
« Reply #10 on: November 27, 2012, 11:45:09 AM »
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.

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.

Offline Bigguy

  • SMF Friend
  • SMF Super Hero
  • *
  • Posts: 12,960
  • Gender: Male
  • Be nice, or else....
    • smfbigguy on GitHub
    • What's Ur Beef
Re: A better upload system
« Reply #11 on: November 27, 2012, 11:55:15 AM »
Nice idea, would love to see this in SMF. :)