CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Java

 get name of uploaded file in another file.jsp

Print topic Send  topic

Author Message
giganggu

Posts: 2
Posted: 05/13/2009, 12:04 PM

Hello sir, I want to get the name of uploaded file from client to server in another file.jsp. How to do it? because I have used session and cookies variable but it cann't work ( the name file cann't knowed) in another file. In this case I am use applet to record sound and send to server. The sound have name randomly. Is it cause the problem to get the name file? There is some jsp synatx :

There is applet I used in my html page, the applet from javasonics,
<applet CODE="com.softsynth.javasonics.recplay.RecorderUploadApplet" mayscript="true" CODEBASE="codebase" ARCHIVE="JavaSonicsListenUp.jar" NAME="JavaSonicRecorderUploader" WIDTH="400" HEIGHT="130">
<param name="uploadFileName" value="voiceprint.wav">
<!-- Server script to receive the multi-part form data. -->
<param name="uploadURL" value="handle_upload_simple.jsp">
<param name="format" value="u8">
</applet>

And there is is piece of my handle_upload_simple.jsp syntax that make filename randomly:
if (fileName.equals("voiceprint.wav")){

Random rnd = new Random();
fileName = fileName.substring(0, fileName.indexOf("."))+"_"+System.currentTimeMillis()+rnd.nextDouble()+".wav";
int lastSlash = fileName.lastIndexOf( '\\' );
if( lastSlash >= 0 ) fileName = fileName.substring( lastSlash + 1 );
lastSlash = fileName.lastIndexOf( '/' );
if( lastSlash >= 0 ) fileName = fileName.substring( lastSlash + 1 );
String pathName = UPLOAD_DIR + "/" + fileName;
File uploadedFile = new File( pathName );
item.write(uploadedFile);
buf.append("FILE:\n field: " + fieldName + "\n file name: " + fileName +
"\n content type: " + contentType + "\n size: " + sizeInBytes );

buf.append("\nSUCCESS - uploaded\n");
String file=(String) fileName;
session.setAttribute("namaFile",file);
}

How to fixed it? Thank you very much for helps
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.