Headers And Javascript

Image previewer add-on.
bigeagle
Posts: 10
Joined: Sat Nov 01, 2008 5:54 pm

Headers And Javascript

Post by bigeagle »

Hi,

I've 2 questions about the jImageUpload application.
1) I try to send a custommessage to the applet but I receive the entire time: "upload failed: server error".
The code I have in the applet js file:

Code: Select all

   document.writeln('<PARAM NAME="paramfile" VALUE="uploadfile">');
  document.writeln('<PARAM NAME="param1" VALUE="todo">');
  document.writeln('<PARAM NAME="value1" VALUE="upload">');
  document.writeln('<PARAM NAME="param2" VALUE="errorheader">');
  document.writeln('<PARAM NAME="value2" VALUE="custommessage">');
  document.writeln('<PARAM NAME="param3" VALUE="relativefilename">');
  document.writeln('<PARAM NAME="value3" VALUE="true">');
  
and in my PHP file for test:

Code: Select all

  header("HTTP/1.1 401 OK");
  header("custommessage: blaat");
 
The java applet won't show this custom message.
What is the fault?

2) The next question is about Javascript.
ABove my applet i've a set of checkboxes. I want the checked one in my Java post.
Is there a way to do that?

Thkx in advance!

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Headers And Javascript

Post by support »

For #1, edit i18n_bar.properties and replace:
progress.bar.upload.failed.label=Upload failed : {0}
by:
progress.bar.upload.failed.label=Upload failed : {0} {1}

For #2, use setParameter(...) JavaScript function. For instance, when end-user clicks on the checkbox, get the value and pass it to the applet through:
document.fileupload.setParameter("yourparameter","yourvalue");

Does it help ?

bigeagle
Posts: 10
Joined: Sat Nov 01, 2008 5:54 pm

Re: Headers And Javascript

Post by bigeagle »

Thanks for your reply. Both options don't working.

#first
The same problem occurs. I receive the same warning: Upload failed: server error and I've changed the line you sad(say)

#second
I've tried that already but wenn I do that I get a error that the document.clientupload is empty or no object.

edit:
Ah, the first thing is solved. They name of the applet was different so it was clear that they couldn't find the object.
Only the first question doesn't work.

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Headers And Javascript

Post by support »

For #1, could you download and install 2.2 ? I tested it with 2.2 and it was working.

bigeagle
Posts: 10
Joined: Sat Nov 01, 2008 5:54 pm

Re: Headers And Javascript

Post by bigeagle »

I've installed version 2.2. Which code are you using?
Do you've a example or are the code in my first post right?

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Headers And Javascript

Post by support »

Your code seems OK except if your PHP script already started to write before putting the header.

Try our PHPScript 2.1 below. Modify upload directory and do not modify max size. Then try to upload a 2MB image and you should see the custom error message from server displayed in applet:
http://www.jfileupload.com/products/tools/index.html

The applet_http_php.js includes all correct parameters.

bigeagle
Posts: 10
Joined: Sat Nov 01, 2008 5:54 pm

Re: Headers And Javascript

Post by bigeagle »

Thanks it's working fine now. I've realy no idea what the problem was but it's working.
There's well a little strange thing. I've the next line in my code:

document.writeln('<PARAM NAME="resources" VALUE="i18n">');

Wenn I change the first line of this file (file i18n.properties) nothing happen in the applet:
# Info panel
taskoutput.usage=Selecteer een foto en sleep hem hierin

That line I've changed but the java applet shows still: Drag & Drop your images here.
What is the fault?

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Headers And Javascript

Post by support »

It might might because the applet don't find the i18n.properties. Are you able to access this file directly in browser through http://yourserver.com/something/i18n.properties

Also, when you modify this file you have to close all browser windows before testing to make sure the applet is unloaded.

bigeagle
Posts: 10
Joined: Sat Nov 01, 2008 5:54 pm

Re: Headers And Javascript

Post by bigeagle »

Hi,

No the applet might find the properties file. You can see it:
[edit]

I've changed the intro text but the applet sill showing the old one...
Last edited by bigeagle on Wed Nov 05, 2008 10:34 pm, edited 2 times in total.

User avatar
support
Posts: 1503
Joined: Sun Jan 27, 2008 6:19 pm

Re: Headers And Javascript

Post by support »

Your applet is working with i18n. Your question was about "Drag & Drop your images here" and it's an image, that's why you cannot modify the text :-) However you can modify the image in i18n_pane.properties. Replace:
preview.image.background=jfileupload/transfer/client/preview/dnd.jpg
by:
preview.image.background=yourimage.jpg

Post Reply