SlickUpload
Welcome Guest Search | Active Topics | Log In | Register

Upload Result without clicking on Save in sample. Options
Haken
#1 Posted : Friday, January 13, 2012 7:12:37 PM
Rank: Newbie

Groups: Registered

Joined: 1/10/2012
Posts: 6
Location: Hawaii

Hi,

Using the Thumbnail demo as an example, how do I remove the SAVE link and still have everything in the uploadResultPanel updated? This might seem trivial, but I can't seem to figure it out.

Haken

Haken
#2 Posted : Monday, January 16, 2012 5:39:27 PM
Rank: Newbie

Groups: Registered

Joined: 1/10/2012
Posts: 6
Location: Hawaii
Okay, after looking over the demo to see what it's really doing, I need to rephrase my question. Is there a way to have the .NET controls updated without a postback, which is what clicking on the SAVE does?

Again, using the Thumbnail Demo as an example, I want to be able to select a file, generate the thumbnail, and then pass fill in a .NET textbox or have the Repeater control display the uploaded file without require the user to submit the form.

Thanks,
Haken
Axosoft
#3 Posted : Wednesday, January 18, 2012 1:00:05 PM
Rank: Administration


Groups: Administrators

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

It sounds like you want to have the upload running in the background of the page, so files are uploaded as the user selects them (sort of like the Slick sample), and then get a notification as each file is uploaded so you can display results on the page.

When you say "pass fill in a .NET textbox or have the Repeater control display the uploaded file", what do you mean? You can't re-render other controls without a postback in ASP.NET, unfortunately. You could, however, update the page by modifying the elements with javascript. Would that work?

If I'm misunderstanding what you're trying to do, can you give me a more detailed flow of what you're trying to accomplish?

Haken
#4 Posted : Friday, January 27, 2012 6:15:59 PM
Rank: Newbie

Groups: Registered

Joined: 1/10/2012
Posts: 6
Location: Hawaii

After several tries I figured out that a postpack is required. I was able to pass a MD5 Hash of an uploaded file back to a .NET control so that I can save it along with other database fields I had. The only problem I'm having now is I can't figure out why the following lines of code from your Thumbnail example is causing an error.

kw(function () {
kw("<%=slickUpload.ClientID %>").start();
});

For some reason, it interferes with the postback of my other .NET controls.

Without the code, I can add a file, it'll show calculating and nothing happens next, which makes sense since that piece of code starts the upload process.  If I click on another .NET control, which causes a postback, the file is uploaded and I can see the thumbnail.  However, to process the image, I'll have to trigger another postback.

With the code, the file is uploaded, the thumbnail is displayed, but after that, it interferes with the postback of my other controls (like clicking a button to save to the database).

I'll work on it a bit more, maybe I overlooked something.

 

 

 

 

Axosoft
#5 Posted : Monday, January 30, 2012 12:00:41 PM
Rank: Administration


Groups: Administrators

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

Can you describe more about your intended flow? That will help me suggest a good way to configure SlickUpload to conform to what you want to do.

You can configure SlickUpload so it uploads asynchronously, without any postbacks. However, if you have a file selected, and then trigger a full page postback (whether from SlickUpload or another control on the page), the file must be uploaded with that postback or the selection will disappear. The only way to select a file is through user interaction (being able to select a file through code would lead to security holes), so if the file isn't uploaded with the postback, the DOM will be reset (with the new page response from the postback) and there is no way for SlickUpload to reselect the file through code.

Haken
#6 Posted : Monday, January 30, 2012 2:09:05 PM
Rank: Newbie

Groups: Registered

Joined: 1/10/2012
Posts: 6
Location: Hawaii

I'm using the control as part of a user profile page where users can upload a profile picture and also fill out information about themselves. I'm using the Thumbnail Demo you have as my starting point and have created a page with both .NET Textbox controls and also the single Slickupload control. Here is the basic flow.

- User click on Add File to select image to upload.
- When upload is completed, a MD5 hash is performed on the uploaded image.
- uploaded image filename is then renamed to the MD5 hash.
- Thumbnail is created and is also renamed to MD5 hash with a 'T' prefixed in front.
- Thumbnail appears on page so that user can see it.
- User fills in other info in .NET textbox controls on page.

- When all fields are filled in, user clicks submit and all information along with MD5 hash are stored in the database.

That's pretty much what I want it to do. As I have said, if I include:

kw(function () {
kw("<%=slickUpload.ClientID %>").start();
});

the upload works fine and the thumbnail is displayed, but I am unable to submit or read the MD5 sum that is passed back from the upload and save the info to the database, possibly because of an error.

If I leave out the code, I can add a file, but the progress bar is stuck on 'Calculating,' and the upload and thumbnail doesn't appear until I trigger a postback by clicking on a submit butting, etc.. After I trigger the postback, the thumbnail appears and I am able to fill in the other boxes and then click submit and save info in the other textboxs along with the MD5 hash (from UploadedFile object in the UploadedFiles collection) that was passed back from the SlickUpload.

I guess what I don't understand is why including the code above would cause an error when in the demo it works fine. Is it because I'm mixing it with other .NET controls /javascript on the page and is causing an error?

Note: md5sum is being passed back in the ThumbnailFileUploadStreamProvider with file.Data["md5sum"] and then read on the .NET webform through the slickUpload.UploadSession.UploadedFiles object, just in case you were wondering.

Axosoft
#7 Posted : Tuesday, January 31, 2012 11:05:27 AM
Rank: Administration


Groups: Administrators

Joined: 7/7/2005
Posts: 1,586
Location: Scottsdale, AZ

The reason you need this:

        kw(function () {

            kw("<%=slickUpload.ClientID %>").start();

        });

is to automatically start the upload as soon as the file is selected. You could also handle the onFileAdded event and call .start(), but this way is easier.

Are you reading the MD5 from the UploadStreamProvider and setting it to the textbox client side or server side?

You say you can't get the MD5 hash in certain circumstances, "possibly because of an error". Do you see any server or javascript errors during this process?

If it's possible to put together what you have in a sample project I can run on my end, that might be the easiest way to track down the issue. That way I can get a handle on what's going on end to end. Would it be possible to put something like that together and email it to chris@slickupload.com? If not a full project, at least the full .aspx, codebehind, and uploadstreamprovider files would be useful.

Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.