Help on recompiling, or disabling the browse button -- URGENT please!

Sep 29, 2009 at 6:11 PM

Hello!

I'm using the FileUploader component in order to upload a single file (no multiple uploads allowed). Therefore, when the user selects the desired file to be uploaded, I need the Browse button to be Disabled, while the Upload / Cancel buttons stay Enabled. 

I tried to accomplish this behavior, but I couldn't find a way (method, javascript function, etc) to access the browse button and disable it through my .NET code. 

The disable() method disables all three buttons, and also cancels the upload queue, so that's not what I need. 

So, I decided to take a look at the source code. Indeed I found the line which needs to be changed there, located in FileUploader2.as. Here's the code block: 

 

private function onFilesSelected(evt:FileUploaderEvent):void{
if(Params.instance.debug) t.str("onFilesSelected", "state:"+evt.state);
if(evt.state > 0){
this.setButtons(true, true, true);
}
this.resetProgressBar();
}

private function onFilesSelected(evt:FileUploaderEvent):void{

if(Params.instance.debug) t.str("onFilesSelected", "state:"+evt.state);

if(evt.state > 0){

this.setButtons(true, true, true); I want to change this to "this.setButtons(false, true, true);"

}

this.resetProgressBar();

}

 

 

Unfortunately that piece of code resides in the Flash part of the component. I've downloaded Adobe's CS4 Professional, FlashDevelop (freeware IDE for flash), the needed flash debug versions and the flex SDK. I was able to create an AS3 project, and compile it using FlashDevelop+CS4.

However, when I use the compiled FileUploader2.SWF into the .NET solution that generates the uploader DLL, the uploader does not display ANY buttons (neither the original ones, nor my customized ones). 

This happens whether I change the line stated above or not. So, I concluded that I'm doing something wrong :)

Would anyone pretty PLEASE help me out on either recompiling the component successfully, or disabling the Browse button (after the user selects a file to upload) with the existing functions?

I have the user waiting for this in order to promote the code to Production, and this is VERY urgent. 

Thank you VERY much in advance for ANY help. 

Regards, Carlos

Coordinator
Sep 30, 2009 at 5:06 PM

Sorry the control doesn't have a single upload mode

Sep 30, 2009 at 5:16 PM

But, can't I either disable the browse button programmatically after a file has been selected, or recompile the code and change the onfilesselected event? 

Coordinator
Sep 30, 2009 at 7:02 PM

It can be done, but I won't have the time to go through all the details that need to be done. Most importantly Action Script object must be changed to the single mode one. So a lot of the change is on the flash site. But you have the flash source so you can do that if you want.

Sep 30, 2009 at 10:09 PM

Would it be possible to change a single line of that flash code, and send it out to me by e-mail? Here's the code I need to change: 

 

File: FileUploader2.as

Function: onFilesSelected

Change is outlined in red below: 

private function onFilesSelected(evt:FileUploaderEvent):void{

if(Params.instance.debug) t.str("onFilesSelected", "state:"+evt.state);

if(evt.state > 0){

this.setButtons(true, true, true); I want to change this to "this.setButtons(false, true, true);"

}

this.resetProgressBar();

}

 

The reminder of the code stays unchanged (in all files). 

I know that "compiling / emailing" is a non-standard thing to ask, but my situation is more than urgent, and my customer is just waiting for that. If you could please send the compiled FileUploader2.swf to calcpuc@gmail.com, I'd be REALLY glad. 

 

Again, my e-mail is calcpuc@gmail.com and I just need FileUploader2.swf compiled with the above-mentioned change in FileUploader2.as.

Many thanks in advance!

Coordinator
Sep 30, 2009 at 11:29 PM

Sorry Calcpuc, but I have no time, may be on the weekend, but not earlier than that.

Sep 30, 2009 at 11:31 PM

That would be great!

Thank you VERY much again for all your help, and congrats on the great component!

Carlos

Coordinator
Oct 2, 2009 at 7:25 AM

 

OK I've got some inspiration after my aikido practice today. Here is how to use it for single file mode:
<fjx:FileUploader ID="FileUploader1" runat="server" IsSingleFileMode="true">
    <Adapters>
        <fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder" />
    </Adapters>
</fjx:FileUploader>

 

 

 

<fjx:FileUploader ID="FileUploader1" runat="server" IsSingleFileMode="true">
    <Adapters>
        <fjx:FileSaverAdapter Runat="server" FolderName="UploadFolder" />
    </Adapters>
</fjx:FileUploader>

 

 

Oct 2, 2009 at 1:54 PM

Hello Vlad!

Thanks for the new version. It works if I set IsSingleFileMode="true", and InitiateUploadOnSelect="true". 

However, if I don't set InitiateUploadOnSelect="true" (so that the user MUST click the Upload button in order to initiate the upload), all three buttons are still enabled. :(

Would it be possible to disable the browse button on Select? 

Thanks again for the great help! And hope you have more aikido practices :)

Coordinator
Oct 2, 2009 at 4:04 PM

Oh come on man, you are killing me, browse button is enable because you can se;ect another file and replace the first one.

Oct 2, 2009 at 5:00 PM

Lol I do agree with you, but they want it that way :~(

I'll try to recompile the latest version to see if I can get something other than a blank flash Swf. 

Sorry for bothering you so much man. 

Oct 2, 2009 at 5:03 PM

What they understand is that, since you have the Cancel button available, one should click it in order to be able to select a new file. Therefore, that's why they want the browse button disabled upon a file is selected... pffffff :(