Multipart form (file upload) processing in providers
Hello,
Just want to find out if anyone has successfully implemented a file upload mechanism within a Portal channel.
According to the Provider API (http://docs.sun.com/source/816-6428-10/com/sun/portal/providers/Provider.html), the wrapped request/response objects do not support several methods that are essential to process file uploads, namely "getContentLength" and "getInputStream". I am currently trying to use the Apache commons-fileupload utility which uses those methods to process file uploads. This is also the case for another popular file upload utility from servlets.com.
Does anyone have any info/explanation regarding this limitation in Portal Server 6, and any workarounds to this issue. One workaround is to have a window popup that interacts directly with an external webapp.
Any ideas/suggestions will be appreciated, thanks in advance.
jeff
Hi Jeff,
The Sun ONE Portal Server DesktopServlet does not have the ability to process a request with the content encoding type of multipart/form-data. DesktopServlet does not pass the input stream for the request on to the Provider.
To accomplish handling of multipart/form-data type requests, it is necessary to create a companion servlet or JSP that process the multipart/form-data. This servlet can then pass control back to the Portal channel. The data from the file can be shared between the servlet and the provider by using static Java members or by storing the data in a back-end database and then passing a reference to the data over to the provider.
Sanjeev
Similar Messages
-
Useful Code of the Day: Multipart Form File Upload
So, you want to upload files to your web server, do ya? Well, I've seen this topic posted a few times in the last month or so and many of the response I've seen here haven't included definitive answers. Of course, the actual problems vary, but ultimately, a bunch of people want to do file upload from an applet or application to an existing file upload script (CGI, PHP, JSP, etc.) on a web server. And invariably, there are problems with formatting the HTTP request to get things working.
Well, I had a need to do the same thing. I realize there are other solutions out there, such as some sample code that comes with Jakarta Commons Upload. But since we all like reusable code, and we also all seem to like reinventing wheels, here's my go at it: MultiPartFormOutputStream!
MultiPartFormOutputStream is a specialized OutputStream-like class. You create your URLConnection to the server (a static method included can do this for a URL for you, as some of the settings, doInput and doOutput specifically, seem to confuse people). Then get the OutputStream from it and create a boundary string (a static method to create one is provided as well) and pass them to the constructor. Now you have a MultiPartFormOutputStream which you can use to write form fields like text fields, checkboxes, etc., as well as write file data (from Files, InputStreams or raw bytes).
There are some convenience methods for writing primative type values as well as strings, but any higher level objects (aside from Files or InputStreams) aren't supported. (You can always serialize and pass the raw bytes.)
Sample usage code is below. Also, any recommendations for improvement are requested. The code was tested with the Jakarta Struts.
import java.io.*;
import java.net.*;
* <code>MultiPartFormOutputStream</code> is used to write
* "multipart/form-data" to a <code>java.net.URLConnection</code> for
* POSTing. This is primarily for file uploading to HTTP servers.
* @since JDK1.3
public class MultiPartFormOutputStream {
* The line end characters.
private static final String NEWLINE = "\r\n";
* The boundary prefix.
private static final String PREFIX = "--";
* The output stream to write to.
private DataOutputStream out = null;
* The multipart boundary string.
private String boundary = null;
* Creates a new <code>MultiPartFormOutputStream</code> object using
* the specified output stream and boundary. The boundary is required
* to be created before using this method, as described in the
* description for the <code>getContentType(String)</code> method.
* The boundary is only checked for <code>null</code> or empty string,
* but it is recommended to be at least 6 characters. (Or use the
* static createBoundary() method to create one.)
* @param os the output stream
* @param boundary the boundary
* @see #createBoundary()
* @see #getContentType(String)
public MultiPartFormOutputStream(OutputStream os, String boundary) {
if(os == null) {
throw new IllegalArgumentException("Output stream is required.");
if(boundary == null || boundary.length() == 0) {
throw new IllegalArgumentException("Boundary stream is required.");
this.out = new DataOutputStream(os);
this.boundary = boundary;
* Writes an boolean field value.
* @param name the field name (required)
* @param value the field value
* @throws java.io.IOException on input/output errors
public void writeField(String name, boolean value)
throws java.io.IOException {
writeField(name, new Boolean(value).toString());
* Writes an double field value.
* @param name the field name (required)
* @param value the field value
* @throws java.io.IOException on input/output errors
public void writeField(String name, double value)
throws java.io.IOException {
writeField(name, Double.toString(value));
* Writes an float field value.
* @param name the field name (required)
* @param value the field value
* @throws java.io.IOException on input/output errors
public void writeField(String name, float value)
throws java.io.IOException {
writeField(name, Float.toString(value));
* Writes an long field value.
* @param name the field name (required)
* @param value the field value
* @throws java.io.IOException on input/output errors
public void writeField(String name, long value)
throws java.io.IOException {
writeField(name, Long.toString(value));
* Writes an int field value.
* @param name the field name (required)
* @param value the field value
* @throws java.io.IOException on input/output errors
public void writeField(String name, int value)
throws java.io.IOException {
writeField(name, Integer.toString(value));
* Writes an short field value.
* @param name the field name (required)
* @param value the field value
* @throws java.io.IOException on input/output errors
public void writeField(String name, short value)
throws java.io.IOException {
writeField(name, Short.toString(value));
* Writes an char field value.
* @param name the field name (required)
* @param value the field value
* @throws java.io.IOException on input/output errors
public void writeField(String name, char value)
throws java.io.IOException {
writeField(name, new Character(value).toString());
* Writes an string field value. If the value is null, an empty string
* is sent ("").
* @param name the field name (required)
* @param value the field value
* @throws java.io.IOException on input/output errors
public void writeField(String name, String value)
throws java.io.IOException {
if(name == null) {
throw new IllegalArgumentException("Name cannot be null or empty.");
if(value == null) {
value = "";
--boundary\r\n
Content-Disposition: form-data; name="<fieldName>"\r\n
\r\n
<value>\r\n
// write boundary
out.writeBytes(PREFIX);
out.writeBytes(boundary);
out.writeBytes(NEWLINE);
// write content header
out.writeBytes("Content-Disposition: form-data; name=\"" + name + "\"");
out.writeBytes(NEWLINE);
out.writeBytes(NEWLINE);
// write content
out.writeBytes(value);
out.writeBytes(NEWLINE);
out.flush();
* Writes a file's contents. If the file is null, does not exists, or
* is a directory, a <code>java.lang.IllegalArgumentException</code>
* will be thrown.
* @param name the field name
* @param mimeType the file content type (optional, recommended)
* @param file the file (the file must exist)
* @throws java.io.IOException on input/output errors
public void writeFile(String name, String mimeType, File file)
throws java.io.IOException {
if(file == null) {
throw new IllegalArgumentException("File cannot be null.");
if(!file.exists()) {
throw new IllegalArgumentException("File does not exist.");
if(file.isDirectory()) {
throw new IllegalArgumentException("File cannot be a directory.");
writeFile(name, mimeType, file.getCanonicalPath(), new FileInputStream(file));
* Writes a input stream's contents. If the input stream is null, a
* <code>java.lang.IllegalArgumentException</code> will be thrown.
* @param name the field name
* @param mimeType the file content type (optional, recommended)
* @param fileName the file name (required)
* @param is the input stream
* @throws java.io.IOException on input/output errors
public void writeFile(String name, String mimeType,
String fileName, InputStream is)
throws java.io.IOException {
if(is == null) {
throw new IllegalArgumentException("Input stream cannot be null.");
if(fileName == null || fileName.length() == 0) {
throw new IllegalArgumentException("File name cannot be null or empty.");
--boundary\r\n
Content-Disposition: form-data; name="<fieldName>"; filename="<filename>"\r\n
Content-Type: <mime-type>\r\n
\r\n
<file-data>\r\n
// write boundary
out.writeBytes(PREFIX);
out.writeBytes(boundary);
out.writeBytes(NEWLINE);
// write content header
out.writeBytes("Content-Disposition: form-data; name=\"" + name +
"\"; filename=\"" + fileName + "\"");
out.writeBytes(NEWLINE);
if(mimeType != null) {
out.writeBytes("Content-Type: " + mimeType);
out.writeBytes(NEWLINE);
out.writeBytes(NEWLINE);
// write content
byte[] data = new byte[1024];
int r = 0;
while((r = is.read(data, 0, data.length)) != -1) {
out.write(data, 0, r);
// close input stream, but ignore any possible exception for it
try {
is.close();
} catch(Exception e) {}
out.writeBytes(NEWLINE);
out.flush();
* Writes the given bytes. The bytes are assumed to be the contents
* of a file, and will be sent as such. If the data is null, a
* <code>java.lang.IllegalArgumentException</code> will be thrown.
* @param name the field name
* @param mimeType the file content type (optional, recommended)
* @param fileName the file name (required)
* @param data the file data
* @throws java.io.IOException on input/output errors
public void writeFile(String name, String mimeType,
String fileName, byte[] data)
throws java.io.IOException {
if(data == null) {
throw new IllegalArgumentException("Data cannot be null.");
if(fileName == null || fileName.length() == 0) {
throw new IllegalArgumentException("File name cannot be null or empty.");
--boundary\r\n
Content-Disposition: form-data; name="<fieldName>"; filename="<filename>"\r\n
Content-Type: <mime-type>\r\n
\r\n
<file-data>\r\n
// write boundary
out.writeBytes(PREFIX);
out.writeBytes(boundary);
out.writeBytes(NEWLINE);
// write content header
out.writeBytes("Content-Disposition: form-data; name=\"" + name +
"\"; filename=\"" + fileName + "\"");
out.writeBytes(NEWLINE);
if(mimeType != null) {
out.writeBytes("Content-Type: " + mimeType);
out.writeBytes(NEWLINE);
out.writeBytes(NEWLINE);
// write content
out.write(data, 0, data.length);
out.writeBytes(NEWLINE);
out.flush();
* Flushes the stream. Actually, this method does nothing, as the only
* write methods are highly specialized and automatically flush.
* @throws java.io.IOException on input/output errors
public void flush() throws java.io.IOException {
// out.flush();
* Closes the stream. <br />
* <br />
* <b>NOTE:</b> This method <b>MUST</b> be called to finalize the
* multipart stream.
* @throws java.io.IOException on input/output errors
public void close() throws java.io.IOException {
// write final boundary
out.writeBytes(PREFIX);
out.writeBytes(boundary);
out.writeBytes(PREFIX);
out.writeBytes(NEWLINE);
out.flush();
out.close();
* Gets the multipart boundary string being used by this stream.
* @return the boundary
public String getBoundary() {
return this.boundary;
* Creates a new <code>java.net.URLConnection</code> object from the
* specified <code>java.net.URL</code>. This is a convenience method
* which will set the <code>doInput</code>, <code>doOutput</code>,
* <code>useCaches</code> and <code>defaultUseCaches</code> fields to
* the appropriate settings in the correct order.
* @return a <code>java.net.URLConnection</code> object for the URL
* @throws java.io.IOException on input/output errors
public static URLConnection createConnection(URL url)
throws java.io.IOException {
URLConnection urlConn = url.openConnection();
if(urlConn instanceof HttpURLConnection) {
HttpURLConnection httpConn = (HttpURLConnection)urlConn;
httpConn.setRequestMethod("POST");
urlConn.setDoInput(true);
urlConn.setDoOutput(true);
urlConn.setUseCaches(false);
urlConn.setDefaultUseCaches(false);
return urlConn;
* Creates a multipart boundary string by concatenating 20 hyphens (-)
* and the hexadecimal (base-16) representation of the current time in
* milliseconds.
* @return a multipart boundary string
* @see #getContentType(String)
public static String createBoundary() {
return "--------------------" +
Long.toString(System.currentTimeMillis(), 16);
* Gets the content type string suitable for the
* <code>java.net.URLConnection</code> which includes the multipart
* boundary string. <br />
* <br />
* This method is static because, due to the nature of the
* <code>java.net.URLConnection</code> class, once the output stream
* for the connection is acquired, it's too late to set the content
* type (or any other request parameter). So one has to create a
* multipart boundary string first before using this class, such as
* with the <code>createBoundary()</code> method.
* @param boundary the boundary string
* @return the content type string
* @see #createBoundary()
public static String getContentType(String boundary) {
return "multipart/form-data; boundary=" + boundary;
}Usage: (try/catch left out to shorten the post a bit)
URL url = new URL("http://www.domain.com/webems/upload.do");
// create a boundary string
String boundary = MultiPartFormOutputStream.createBoundary();
URLConnection urlConn = MultiPartFormOutputStream.createConnection(url);
urlConn.setRequestProperty("Accept", "*/*");
urlConn.setRequestProperty("Content-Type",
MultiPartFormOutputStream.getContentType(boundary));
// set some other request headers...
urlConn.setRequestProperty("Connection", "Keep-Alive");
urlConn.setRequestProperty("Cache-Control", "no-cache");
// no need to connect cuz getOutputStream() does it
MultiPartFormOutputStream out =
new MultiPartFormOutputStream(urlConn.getOutputStream(), boundary);
// write a text field element
out.writeField("myText", "text field text");
// upload a file
out.writeFile("myFile", "text/plain", new File("C:\\test.txt"));
// can also write bytes directly
//out.writeFile("myFile", "text/plain", "C:\\test.txt",
// "This is some file text.".getBytes("ASCII"));
out.close();
// read response from server
BufferedReader in = new BufferedReader(
new InputStreamReader(urlConn.getInputStream()));
String line = "";
while((line = in.readLine()) != null) {
System.out.println(line);
in.close();------
"Useful Code of the Day" is supplied by the person who posted this message. This code is not guaranteed by any warranty whatsoever. The code is free to use and modify as you see fit. The code was tested and worked for the author. If anyone else has some useful code, feel free to post it under this heading.I have a weird problem here. I'm using the Java POST (slightly altered for my purposes) mechanism but the receiving script doesn't receive any form variables (neither files nor regular form fields). If I try using the same receiving script with a regular upload form, it works. Because I've been pulling my hair out, I even went so far as to analyze the ip-packets. I can see that the file is actually sent through the Java POST mecahnism. Anybody any ideas. Here's the ip-packet of the failing upload:
----- Hypertext Transfer Protocol -----
HTTP: POST /fotoxs/upload.cfm HTTP/1.1
HTTP: Connection: Keep-Alive
HTTP: Content-Type: multipart/form-data; boundary=-----------------------------fb2649be18
HTTP: User-Agent: Mozilla/4.7 [en] (WinNT; U)
HTTP: Accept-Language: en-us
HTTP: Accept-Encoding: gzip, deflate
HTTP: Accept: image/gif, image/jpeg, image/pjpeg, */*
HTTP: CACHE-CONTROL: no-cache
HTTP: Host: newmarc
HTTP: Content-Length: 15511
----- Hypertext Transfer Protocol -----
HTTP: -----------------------------fb2649be18
HTTP: Content-Disposition: form-data; name="uploadFile"; filename="out.jpg"
HTTP: Content-Type: image/jpeg
HTTP: Data
....[data packets]
The one that works (from the regular post) is as follows:
----- Hypertext Transfer Protocol -----
HTTP: POST /fotoxs/upload.cfm HTTP/1.1
HTTP: Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-gsarcade-launch, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
HTTP: Referer: http://localhost:8500/fotoxs/test.cfm
HTTP: Accept-Language: nl
HTTP: Content-Type: multipart/form-data; boundary=---------------------------7d41961f201c0
HTTP: Accept-Encoding: gzip, deflate
HTTP: User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
HTTP: Host: newmarc
HTTP: Content-Length: 59022
HTTP: Connection: Keep-Alive
HTTP: Cache-Control: no-cache
----- Hypertext Transfer Protocol -----
HTTP: -----------------------------7d41961f201c0
HTTP: Content-Disposition: form-data; name="FiletoUpload"; filename="D:\My Documents\My Pictures\fotomarc.jpg"
HTTP: Content-Type: image/pjpeg
HTTP: Data
----- Hypertext Transfer Protocol -----
HTTP: HTTP/1.1 100 Continue
HTTP: Server: Microsoft-IIS/5.0
HTTP: Date: Sun, 07 Mar 2004 17:14:41 GMT
....[data packets]
One detail worth mentioning is that I don't read a file from harddisk, I'm streaming it directly to the connection outputstream from an image compression utility. But I can see the data in the ip-packets, and even if that somehow didn't work right, it doesn't explaing the fact that the receiving scripts reports no form fields whatsoever.
Thanks,
Marc -
JSP Multipart Form File Upload
Good morning to all.
I searched and googled but camu up with little.
I want to upload a file from an HTML form. I have the enctype set etc. I am receiving all of the data on the server boundaries and all. I know there are readymade packages to do this but I'm one of these types that like to know why something works instead of simply plopping a jar on the server and using it (STD java excepted).
My question is how to parse the data. If you read line by line, looking for the boundaries and you are trying to store the file bytes don't the bytes get corrupted when converting to String (in reader.readLine()) if they are not STD ASCII chars?
Can anyone point me in the direction of a good tutorial on the subject?
Thank you in advance.
STThe basic idea of sending binary data via HTML is to encode into BASE64. This basically involves turning 3 bytes (8-bit) into 4 bytes (6-bit). This is done by representing a 6-bit byte with an ascii character. Instead of me confusing you I've found some code that does it, with lots of helpful comments.
[url http://ostermiller.org/utils/Base64.java.html] dont know if this code works but hey, it looks the part
Ted. -
ICR - FBICS3 file upload process
Dear experts,
In the process of ICR to we want to use the file upload option in the FBICS3(select documents) for reconciliation of the docs. And our file is placed in the application server. We have maintained the configuration in FBIC032 for the company codes(Here we are using multiple company codes), we mentioned the logical file path, custom structure as this file has some new fileds and we are data source as file upload in the data source field in this(FBIC032) config. But when I run the FBICS3 transaction it is not selecting the documents from the file placed on the application server. Can some one help me on this, whether i missed something in the config?
Regards,
Karthik.
Moderator message: not related to ABAP development, please ask again in the appropriate functional or technical forum.
Edited by: Thomas Zloch on Oct 22, 2010 11:23 PMHi Rafael,
Thank you for your answer.
But the file upload functionality is not activated by the transfer type config but by the data source config (=File upload), no?
Unfortnulately, the field data source cannot be modified for process 002 (always equals Documents of current process)
BR
Bernard -
I want to limit the size and type of files that users put in the database through the Oracle Portal.
Has anyone implemented it?Hi Rafael,
Thank you for your answer.
But the file upload functionality is not activated by the transfer type config but by the data source config (=File upload), no?
Unfortnulately, the field data source cannot be modified for process 002 (always equals Documents of current process)
BR
Bernard -
ICR File Upload Process 002 G/L Accounts
Dear SAP experts,
For external companies, we want to upload their intercompany transactions in the intercompany reconciliation cockpit.
But it seems that is not possible for process 002 (G/L accounts): indeed, when I go on the customizing step 'Companies to be reconciled' (FBIC009), I cannot set the data source for one company code to File Upload.
D
o you have any idea so that I can load data in ICR process 002 tables by file upload?
Thank you in advance for helping me,
BernardHi Rafael,
Thank you for your answer.
But the file upload functionality is not activated by the transfer type config but by the data source config (=File upload), no?
Unfortnulately, the field data source cannot be modified for process 002 (always equals Documents of current process)
BR
Bernard -
Hi I have been working with javascript and php to upload files. I am having problems with
the backend of the file upload.
So when the file is recieved in the backend.php . It comes like:
$fileupload=$_POST['upload_file'];
The above $fileupload is the url of the file:
I am trying to extract name , type and size using:
$name=$_FILE['$fileupload']['name'];
$tmp_name=$_FILE['$fileupload']['tmp_name'];
$size=$_FILE['$fileupload']['size'];
But this seems not to work.
echo $fileupload; //gives me the file url.
but:
echo $name or $tmp_name or $size
does not work.
Can any one help.Hi Rob
Thanks so much for the replay. $name=$_FILES['photofield']['name'];
does not work in this circumstance because I am recieving the file through the ajax code below:
<script type="text/javascript">
// JavaScript Document
var phototitle;
var photogenre;
var photodesc;
var photofield;
function AjaxStuff(){
phototitle = jQuery("#phototitle").attr("value");
photogenre = jQuery("#photogenre").attr("value");
photodesc = jQuery("#photodesc").attr("value");
photofield = jQuery("#photofield").attr("value");
jQuery.ajax({
type: "POST",
url: "Uploadfix.php",
cache: false,
dataType: "html",
data: "phototitle=" + phototitle + "&photogenre=" + photogenre + "&photodesc=" + photodesc + "&photofield=" + photofield,
success: function(response){
// if sucessful; response will contain some stuff echo-ed from .php
// alert("Here is your response: " + response);
// Append this response to some <div> => let's append it to div with id "serverMsg"
jQuery("#allresult").append(response);
jQuery("#contentgrid").trigger("reloadGrid");});
} // END OF FormAjaxStuff()
</script>
photofield is the file. Uploadfix.php is where the data is posted:
Uploadfix.php
$phototitle=$_POST['photofield];
the for file:
$photo=$_FILES['photofield']['name'];
echo $photo; //Nothing comes out.
echo $photofield; //The url for the file appears. -
Inconsistent in file upload process
I have a file upload method for Azure blob storage. code as below
CloudStorageAccount cloudStorageAccount;
CloudBlobClient blobClient;
CloudBlobContainer blobContainer;
BlobContainerPermissions containerPermissions;
CloudBlob blob;
cloudStorageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["CLOUDSTORAGE_ACCOUNT"]);
blobClient = cloudStorageAccount.CreateCloudBlobClient();
blobContainer = blobClient.GetContainerReference(fileType);
blobContainer.CreateIfNotExist();
containerPermissions = new BlobContainerPermissions();
containerPermissions.PublicAccess = BlobContainerPublicAccessType.Blob;
blobContainer.SetPermissions(containerPermissions);
blob = blobContainer.GetBlobReference(FileName);
blobClient.ParallelOperationThreadCount = 2;
IAsyncResult result = blob.BeginUploadFromStream(InputStream, null, null, null);
blob.EndUploadFromStream(result);
Which is working fine in local but once hosted as Azure application , file upload is throwing error as :
The server encountered an unknown
failure: The underlying connection was closed:
Could not establish trust relationship for the SSL/TLS secure channel.
After some time it will work fine. Can you help me exactly what may be wrongHi Srinivas,
Have you checked if there is a problem in the system time syncing to the time servers?
If its is a sync issue, to correct it, you could:
Right-click the clock in the task bar
Select Adjust
Date/Time
Select the Internet
Time tab
Click Change
Settings
Select Update
Now
There might be an issue with the SSL certificate as well.
Are you using a self signed certificate? Do the host name between the certificate and the server match?
You could try overriding the client certificate (This is dangerous if you are calling a server outside of your direct control, since you can no longer be as sure that you are talking to the server
you think you're connected to.) You could try the following code:
//Trust all certificates
System.Net.ServicePointManager.ServerCertificateValidationCallback =
((sender, certificate, chain, sslPolicyErrors) => true);
Also for details you could refer the following links, where the customers are facing similar issues:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/bb0fc194-5bf3-4c24-94bb-c86f94c76bc2/could-not-establish-trust-relationship-for-the-ssltls-secure-channel-with-authority-pc1?forum=wcf
http://stackoverflow.com/questions/703272/could-not-establish-trust-relationship-for-ssl-tls-secure-channel-soap
Regards,
Malar. -
VS2010 not recording file upload process for web test
I'm trying to record the process of uploading a file to the system.
The problem is when a new browser opens for uploading a document, the visual studio is not recording the URL (....Attachement/Upload.aspx) and related Form Post Parameters.
Is there any settings to able to record when a new browser pops up?
I'm using VS2010 ultimate and the system is on MS Dynamics CRM platform.Hi,
this is the forum for Microsoft Office Visio.
It seems from your question that you need assistance with Visual Studio.
The Visual Studio forums are located in MSDN, not here in TechNet.
Try here:
http://social.msdn.microsoft.com/Forums/en-US/home?forum=visualstudiogeneral
Don
(Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!) -
VS2010 does not record file upload process for web test
I'm trying to record the process of uploading a file to the system for web performance test.
The problem is when a new browser opens for uploading a document, the visual studio is not recording the URL (....Attachement/Upload.aspx) or POST and related Form Post Parameters.
Is there any settings to able to record when a new browser pops up?
I'm using VS2010 ultimate and the system is on MS Dynamics CRM platform.Hi Michi,
>>A new browser pops up.
Could you share us a screen shot about it? Do you mean that it opened a new tab in the same window or a new window in your IE browser?
Maybe you could use the Fiddler tool to record a web performance test, check the result.
http://blogs.msdn.com/b/slumley/archive/2007/04/17/enhanced-web-test-support-in-fiddler.aspx
Best Regards,
Jack
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
I need a little help with the file upload process in flex..
I am trying to upload a file.. i had it where i would get a cgi-script url passing as the following
filename="filename"&filedata="data of the file"
then my cgi script "written in C" would read from standard in.. and write the info to a file...
now i get the following..
------------KM7Ef1gL6Ij5cH2ae0ei4Ij5GI3Ef1
Content-Disposition: form-data; name="Filename"
Botanical Garden 239.JPG
------------KM7Ef1gL6Ij5cH2ae0ei4Ij5GI3Ef1
Content-Disposition: form-data; name="Filedata"; filename="Botanical Garden 239.JPG"
Content-Type: application/octet-stream
in the file i am trying to write.... Can anyone help me fix this problem? I am clueless at this point on what to do..
sample code below is what i got from trying to work this...
Thanks in advanced for anyones help..
<code>
const FILE_UPLOAD_URL:String = "http://172.16.1.6:1111/cgi-bin/login.cgi";
private function init():void {fileRef =
new FileReference();fileRef.addEventListener(Event.SELECT, fileRef_select);
fileRef.addEventListener(ProgressEvent.PROGRESS, fileRef_progress);
fileRef.addEventListener(Event.COMPLETE, fileRef_complete);
private function browseAndUpload():void {fileRef.browse();
message.text =
private function fileRef_select(evt:Event):void {
try {message.text =
"size (bytes): " + numberFormatter.format(fileRef.size);fileRef.upload(
new URLRequest(FILE_UPLOAD_URL) );
trace("going to print file data in a sec... ready?");
trace(fileRef.data);
trace(fileRef.name );}
catch (err:Error) {message.text =
"ERROR: zero-byte file";}
private function fileRef_progress(evt:ProgressEvent):void {progressBar.visible =
true;}
private function fileRef_complete(evt:Event):void {message.text +=
" (complete)";progressBar.visible =
false;}
</code>Here are some code....
Forms
<%@ page language="java" session="true" %>
<html>
<head>
<script>
</script>
</head>
<body>
<form name="myform" method="post" action="fileproc.jsp" enctype="multipart/form-data">
<input type="file" name="myfile">
<input type="submit" value="submit">
</form>
</body>
</html>Process
<%@ page language="java" session="true" import="com.oreilly.servlet.*"%>
<html>
<head>
</head>
<body>
<% String s = request.getParameter("myfile"); %>
<%=s%>
<br>
<%
MultipartRequest multi = new MultipartRequest(request, "C:/multipart/", 10*1024*1024); // 10MB
Enumeration params = multi.getParameterNames();
while (params.hasMoreElements()) {
String name = (String)params.nextElement();
String value = multi.getParameter(name);
out.println(name + " = " + value);
out.println();
Enumeration e = multi.getFileNames();
while(e.hasMoreElements()){
String fname = (String)e.nextElement();
out.println("<h1>"+fname+"</h1>");
File fl = multi.getFile(fname);
FileReader fr = new FileReader(fl);
BufferedReader buf = new BufferedReader(fr);
while(buf.ready()){
out.println(buf.readLine());
out.println();
buf.close();
fl.delete();
%>
</body>
</html>Hope this helps.... -
Flash 8 file upload .doc & .pdf help, please
I've been working with the file upload sample that came with
Flash 8 as well
as other sources to help me figure this one out... like:
http://www.flash-db.com/Tutorials/upload/index.php
Everything I seem to find out about file uploading with Flash
specifically
deals with images, but I need to upload .doc & .pdf files
to attach to an
email as part of an employment application process for a site
that is built
with Flash.
The back-end script is a simple ColdFusion file that I've
tested (and works
fine with a static HTML test page):
<cffile action="upload"
destination = "ServerAddressHERE"
accept = "image/jpg, application/msword, application/pdf"
fileField = "Form.resumeFile"
nameConflict = "Overwrite">
The Flash example script that comes with Flash 8 has been
modified as
follows:
System.security.allowDomain(" FQDN_here");
import flash.net.FileReference;
// The listener object listens for FileReference events.
var listener:Object = new Object();
// When the user selects a file, the onSelect() method is
called, and
// passed a reference to the FileReference object.
listener.onSelect = function(selectedFile:FileReference):Void
// Update the TextArea to notify the user that Flash is
attempting to
// upload the image.
statusArea.text += "Attempting to upload " +
selectedFile.name + "\n";
// sample code provided by Flash
selectedFile.upload("
http://www.helpexamples.com/flash/file_io/uploadFile.php");
// my modification here (I have tried absolute references as
well):
selectedFile.upload("upfile.cfm");
listener.onOpen = function(selectedFile:FileReference):Void {
statusArea.text += "Opening " + selectedFile.name + "\n";
// Once the file has uploaded, the onComplete() method is
called.
listener.onComplete =
function(selectedFile:FileReference):Void {
// Notify the user that Flash is starting to download the
image.
statusArea.text += "Downloading " + selectedFile.name + " to
player\n";
// this part is irrelevant to my needs and I've worked with
and without it
imagesCb.addItem(selectedFile.name);
imagesCb.selectedIndex = imagesCb.length - 1;
downloadImage();
var imageFile:FileReference = new FileReference();
imageFile.addListener(listener);
uploadBtn.addEventListener("click", uploadImage);
// this part is irrelevant to my needs and I've worked with
and without it
imagesCb.addEventListener("change", downloadImage);
imagePane.addEventListener("complete", imageDownloaded);
function imageDownloaded(event:Object):Void {
if(event.total == -1) {
imagePane.contentPath = "Message";
// this part is where I added the extensions I need:
function uploadImage(event:Object):Void {
imageFile.browse([{description: "Image Files", extension:
"*.jpg;*.gif;*.png;*.doc;*.pdf,"}]);
ANY ideas would be sincerely appreciated... even if it's just
to confirm
that the Flash file upload process ONLY works with image
files.... Thank you
ALL in advance for ANY help I can get. :-)Did you ever get your issue with the F12, publish preview,
not loading your browser? I have just upgraded from MX 2004 to 8
and now have this issue.
T Peluso
[email protected] -
RE: HTTP File upload using WebEnterprise
AFAIK, WebEnterprise does not support the multipart-mime file upload
feature. I think this is something that is targeted for the next
release.
On a project here we wrote our own cgi program to handle file uploads,
but unfortunately this was not integrated with the rest of the Forte
backend. The suggestion from Forte was to make C++ calls into our Forte
service objects from our CGI. We haven't yet implemented this, but it
certainly seems like it will be possible.
By all means, let us know if you find a better mechanism than this.
It's certainly not the cleanest in the world.
Sam Yates
Systems Analyst
Amgen, Inc
[email protected]
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Hi,
You should have a parameter called ServiceName in your request
(either in the URL or as a hidden parameter in the form) for any request
you send to fortecgi. The cgi uses this information to send your request
to the proper forte application.
In your example you would need something like this
<FORM ENCTYPE=3D"multipart/form-data" ACTION=3D"...." METHOD=3DPOST>
Send this file: <INPUT NAME=3D"userfile" TYPE=3D"file">
<INPUT TYPE=3D"submit" VALUE=3D"Send File">
<INPUT TYPE="Hidden",Name="ServiceName",Value="MyService">
</FORM>
MyService is the name is the name you have given for the service when
you call EnableAccess in your subclass of HTTPAccess.
This is all explained in the Web Enterprise /SDK manual.
Note : You would also need a parameter PageName when using Web SDK. I
have not used Web Enterprise yet but I presume it is the same there too.
Hope this helps
Santha Athiappan
Get Your Private, Free Email at http://www.hotmail.com
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/> -
Hi there,
I am experiencing some problems with a WL 5.1 sp8 server trying to do a
form (multipart/form-data) upload of a file.
I am using the com.oreilly package but get a Corrupt form data error
when instatiating the MultipartRequest object in the contructor of the
MultipartParser
Object.
Have anyone solved this on a WL 5.1 using the IIS plugin??
regards
Klaus Petersen
Alpha-Gruppen A/S
[email protected]
Hi there,
I am experiencing some problems with a WL 5.1 sp8 server trying to do a
form (multipart/form-data) upload of a file.
I am using the com.oreilly package but get a Corrupt form data error
when instatiating the MultipartRequest object in the contructor of the
MultipartParser
Object.
Have anyone solved this on a WL 5.1 using the IIS plugin??
regards
Klaus Petersen
Alpha-Gruppen A/S
[email protected]
-
Unable to install File Upload Utility in AIX system
Hello,
I installed the Forms File Upload Utility, through CGI, following the steps described in the html
document provided with the utility. That is:
- i copied the files UploadClient.jar.sig and UploadServer.jar to the directory
/ias102/6iserver/forms60/java;
- i edited the .profile file, for the variable CLASSPATH to include the forms60/java directory:
CLASSPATH=/ias102/6iserver/forms60/java:/ias102/6iserver/forms60/java/UploadServer.jar:/ias102/6iserver/discwb4/classes/locator.jar:/usr/java131/jre/lib/rt.jar:
- i edited the .profile file, for the variable PATH to include the requested directories (Forms \bin and \bin\classic):
PATH=/ias102/6iserver/lib:/ias102/6iserver/bin:/usr/java131/jre/bin/classic/:/us
r/java13
1/bin:$PATH
(i also tried editing the CLASSPATH and PATH variables in the forms60.sh and forms60_server files)
- on my machine (client machine) i installed the PJC.x509 certificate;
After this installation, i included the Demo Form provided with the utility in my test application, and then i executed
the form.
I tried to upload a file but i got the following error: "FRM-40735: WHEN-BUTTON-PRESSED trigger raised unhandled exception ORA-06508"
I looked in the html document, in the "Troubleshooting" section, and i did a test pressing
the Key-Listval (Control+L by default), that would pop up a dialog containing
the current CLASSPATH, but instead i got the following error:
"FRM-40735: KEY-LISTVAL trigger raised unhandled exception ORA-105100."
In the html said that "If this fails then this is because Forms cannot instanciate any Java code
at all".
Do i need to add any more environment settings?
Thanks, JorgeThere are probably several environment variables which need to be set in order for the Forms runtime to communicate with Java. However, to where they point will depend on which Java home you choose to use. For Forms 6.x, you must use the equivalent of JDK 1.1.8 or 1.2.2. These versions are included in the Oracle home. If you try using a newer version (like the one installed on the OS) you will likely have problems.
Verify these env variables point to the appropriate locations to use the jdk/jre in the Oracle Home:
PATH
CLASSPATH
LIBPATH
LD_LIBRARY_PATH
JAVA_HOME
Additionally, ensure that your CLASSPATH includes references to the following jar files:
importer.jar
rt.jar
Maybe you are looking for
-
IPad as external monitor, direct connection
I frequently use my iPad as a second display for my MBP via AirDisplay. Though AirDisplay works very well, even with a decent wifi connection I'll often experience lags in display updates. Can anyone suggest alternative ways to hook up an iPad as a
-
Hi, I want to read a Function module and its parameter dynamically in ABAP Coding not with SE37. Is there a function module or other utility in SAP to do this? Kindly Barbara
-
How to obtain row number when a new row is created (without commit)?
I have this: <NamedData NDName="LineaNro" NDValue="#{bindings.VOIpmDistribucionManualEBS1.currentRowIndex}" NDType="oracle.jbo.domain.Number"/> When I push the New button, the value shows -1. If I push again, the value shows 0... but for third time a
-
Hi Freinds, I am facing some problem in IDOC creation . We have used MATMAS03 as basic type. And activated the chang poineter. But for some materials it is not generating IDOC. When we saw table BDCPS with the change pointer number from BDCP it is s
-
The pitch for all my music got higher and faster - I must have adjusted something wrong?
The pitch for all my music in ITunes got higher and faster - I must have adjusted something wrong? I went back and tried to fix all my audio, but it is still happening.