Telling the server theres an uploaded file

Jan 6, 2009 at 4:27 PM

Yeah sorry, I couldn't think of a better thread title...

My problem is: I can't figure out how to manage the just uploaded file(s) programatically on the server. Preferably I would also like to manipulate the client after that. Like, transfering him to a new site. I tried many things, including:

  • WebMethods
  • __doPostBack (Making a normal postback out of the AJAX stuff for uploadin', no luck)
  • Protected Sub FileUploader1_FileReceived
  • RequestAsPostBack="true"

With WebMethods I had the problem not to be in the current page context, I couldn't get access to the FileUploader's files. Also it often stuck at 99%, but I figured it out so far.. But didn't help me.

__doPostBack ... well, I can't access the files through FileUploader1...?

FileReceived, didn't allow me to do anything... it seems..

RequestAsPostBack just renders the control unfunctional. You choose your file, click  upload and... nothing... Nothing happens. It just stays there, without going 1%-100% or somethinng.

So... I'm looking forward to an answer...

Yours Sincerely

Jan 6, 2009 at 5:25 PM
When sombody says like that that nothing works without bothering to post a single line of code I have really hard time to address the question. RequestAsPostBack works just fine, but I don't know what kind of mess you have there. I guess you need to get through some tutorial to understand what is server side code and what is client side code.
Jan 6, 2009 at 5:32 PM
Edited Jan 6, 2009 at 7:37 PM

Well, I do know the difference. 

And I didn't do much, I used your Javascript code to get the event when the upload finishes. I used it to call either a WebMethod or a PostBack, which both didn't work.

Then I read that its possible for the control itself to use postbacks. Which I then tried, but it rendered the Control unusable. And the normal FileUploaded (or something like that, I can't remember right now) event didn't trigger or something, I don't know...

I don't have any code samples right now, but there wasn't much to begin with. I removed it again, because I couldn't use it...

So, I wanna achieve that I am inside of servercode in page context, the file's uploaded, and I can do what I want with it, on server code!

Like when you use a normal ASP:FileUpload, you put a FileUpload, put a Button, use the button to read what "FileUpload.Hasfile" is. If true, save the file with the Save command or take it's bytes. Just like that, nothing else :/. With the difference, that I got a ProgressBar!

Jan 6, 2009 at 6:11 PM
Edited Jan 6, 2009 at 6:12 PM
I am not sure I understand your issue but here is a very simple sample:

<script runat="server">
protected void FileNameDetermining(object sender, FileNameDeterminingEventArgs args)
    // here you can handle server side code just before being saved
script> function FileStateChanged(uploader, file, httpStatus, isLast){ Flajaxian.fileStateChanged(uploader, file, httpStatus, isLast); if(file.state > Flajaxian.File_Uploading){
// here you can handle client side code for the saved files //"bytes:"+file.bytes+" name:"" state:"+file.state+" httpStatus:"+httpStatus+" isLast:"+isLast+"</br>"; } } </script>
<fjx:FileUploader JsFunc_FileStateChanged="FileStateChanged" runat="server" > <Adapters> <fjx:FileSaverAdapter OnFileNameDetermining="FileNameDetermining" Runat="server" FolderName="UploadFolder" /> </Adapters> </fjx:FileUploader>
Jan 6, 2009 at 8:02 PM
Edited Jan 7, 2009 at 1:01 PM

Thats what I am searching for... 

I tried it out...

[code]  Protected Sub FileNameDetermining(ByVal sender As Object, ByVal args As com.flajaxian.FileNameDeterminingEventArgs)
'TextBox1.Text = args.FileName
args.CancelProcessing = True
End Sub

[code]<fjx:FileUploader runat="server" OnFileNameDetermining="FileNameDetermining" >
<fjx:FileSaverAdapter Runat="server" FolderName="Uploaded" />


Apart from some customizations, this is the same code (except for the OnFileNameDetemining, I had something else there)

I tried manipulating a textbox, but saw, nothing happened, oh well, seems its because it's ajax or something

So then I tried, just to see if it works, to Cancel the processing of the file, so, if I don't see it inside of the folder, it worked.

Well, the file was there, and yeah..

EDIT: Damn, how do you do Code tags? Also, I found my error. OnFileNameDetermining is at the Adapter. Oh man... 

Okay, still no stuff editing, guess I have to deal with it. But he didn't upload the file" Horray!

EDIT2: Now I only get 0 byte files... wonder how I killed it