Extra line while downloading xl file via gui_download
Hi,
I am download a XL file using the gui_download.
but one line automaticall coming like
F1 F2 F3 F4 ....... and so on
to all the fields..
Please give any advise how to remove that first line with F1.....and so on..
Thanks,
Suresh
Hi,
Please chec kthe below FM see the paramenters i m passing
g_full_path ---> will have the file path
itab_amex ---> this is my final internal table with headings...
i m not using fieldnames , because it is not giving full headings..
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE =
filename = g_full_path
filetype = 'DBF'
APPEND = 'X'
WRITE_FIELD_SEPARATOR = 'X'
header = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = 'X'
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = ' '
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH =
TABLES
data_tab = itab_amex
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
IF sy-subrc <> 0.
Similar Messages
-
Error while downloading a file via APEX screen
While I try to download a file using the below code;
an HTTP 404 error is coming although the proc is being called and the parameter is correctly being passed.
Please help.
create or replace procedure download_myfile1(p_id in number)
as
v_mime varchar2(255);
v_length number;
v_file_name varchar2(2000);
Lob_loc BLOB;
BEGIN
-- -- Selecting the details from the table whoch contains the extracts
select EXTRACT_FILE,FILE_NAME,dbms_lob.getlength(EXTRACT_FILE) into lob_loc,v_file_name,v_length from table_name where ID = p_id;
-- -- set up HTTP header
-- -- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from windows
owa_util.mime_header( 'application/octet', FALSE );
-- set the size so the browser knows how much to download
--v_file_name := substr(v_file_name,1,instr(v_file_name,'.')-1);
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment; filename="'||v_file_name|| '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( lob_loc );
end download_myfile1;
It shows a POP up window by which u can save or opens the file. But no pop up displayed in this case.
-ShreyaHi,
Made the same changes but still getting the same error.
The earlier URL also that I had mentoned would dynamically make this url mentioned by you and then shows the pop up window.
However when I am right clicking on the download link and then clicking 'Save target as' then this error message is provided:
Internet Cannot download [schema name].download_myfile2 from [DNS name]
Internet Explorer was not able to open this Internet Site.The requested site is either unavailable or cannot be found .Please try again.
Please help..
Thanks in Advance ...
Shreya
Edited by: 935203 on Jul 9, 2012 11:58 PM -
How to download a file via web service in Windows Phone 8.1?
My project just got 2 part.
1.Pivot app
2.Webclient server (provide data for pivot app the view the data)
My concert that how do i do a download button to download a file via web services in to isolated storage.
urgent!something like this:
public async System.Threading.Tasks.Task DownloadFile()
using (var client = new Windows.Web.Http.HttpClient())
var stream = await client.GetInputStreamAsync(new System.Uri("http://urltomyfile"));
var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("myfile.txt", CreationCollisionOption.GenerateUniqueName);
using (var fileStream = await file.OpenAsync(FileAccessMode.ReadWrite))
IBuffer buffer = new Windows.Storage.Streams.Buffer(1024);
while ((buffer = await stream.ReadAsync(buffer, buffer.Capacity, InputStreamOptions.None)).Length > 0)
await fileStream.WriteAsync(buffer);
await fileStream.FlushAsync();
how is your webservices offering the file?
Microsoft Certified Solutions Developer - Windows Store Apps Using C# -
I have icloud and a new iPhone5 ! They work good , took pictures and a few short movies, plugged in my phone to my iMac transfered Items to iPhoto then inported items to iMovie. when getting to know what i was doing i decided to delete pictures and movies i no longer wanted. when i looked for a few missing items i opend Finder and there some where buyt i had already trashed them and deleted the doubles. Still could not find missing pictures and movies 3 items and today after calling yahoo about a different complant with sending feed back for Yahoo mail Applications login . i opened up Attachments Not the Large Attachments just Attachments and there were the 3 items i had been hunting for to Trash and delete. the mail Attachments file does not have the Option to delet Files and photos and movies. When i tried to Download the 3 items a window shows up that says Error While Downloading the Files, A Server Error has occured, please Try Again later. nothing works how do i remove the Trapped photo and movie Blank Files and trash them? Onece they get into my downloads i can do something with them as i understand. That part of it kind of keeps me in Question also because why should i have to down load my own files of Attachments / Pictures and movies if they are comming from my iMac? How much better is iLife11 then iPhoto08 and iMovie08 . Thanks Greg
Hello,
Thank you for your post.
This is a quick note to let you know that we are performing research on this issue.
If you have feedback for TechNet Subscriber Support, contact
[email protected]
Simon Wu
TechNet Community Support -
Is there a way I can 'select all' for downloading purchase files via family sharing instead of selecting each file or folder one at a time?
or home sharing
-
I am the user of latest firefox 3.6.6 browser. I am getting problems of frequent crashes whenever i tries to install any addon. The crashes also occures whenever i want to download any file.
I am also receiving errors while downloading any file like:
"C:\Users\****\AppData\Local\Temp\******.001.part could not be saved, because you cannot change the contents of that folder.
Change the folder properties and try again, or try saving in a different location. I already changed it many many times but still the same problem."
Adobe flash palyer is also giving problems of not responding. I am using updated version of it already. Java is also updated.
I already uninstalled firefox compeletly and re installed it many many times but still the same problem. I also scanned my computer with avira and malware bytes' Anti malware and got no dection. Please ractify this problem ASAP lest my profession will suffer.
== Crash ID(s) ==
b7f518f2-8d86-41ca-8bab-aee632100709; 1d790e10-d8eb-4904-98c9-94bc62100708; f042d319-b9f8-42ed-a8cb-57c7d2100708Please help.
It is getting worse
Adobe flash player is crashing. I already uninstalled and re installed the latest ver. Also it is hanging randomly.
Please help. -
Problem downloading a file via http
Hi
I'm just getting started with WLS (sp5) and am having a problem downloading
a file via http. The document is stored in the main html docs directory and
whenever I link to it or try to download it directly (eg:
http://<host>:<port>/myfile.doc) I get the following error in a message box:
Your current security settings do not allow this file to be downloaded.
Can anyone point me in the right direction as to where I grant permissions
to do this - I've tried using the weblogic.security.URLAclFile and adding
the directory as a weblogic.io.fileSystem (a desperation move, I know).
Thanks in advance,
Peter VilliersPLEASE IGNORE THIS POST
The problem was caused by someone (me though I honestly don't remember doing
it), setting the content security level to high in my web browser which
stopped this type of download.
Peter -
How to get Header in Downloaded .xls file using GUI_Download function
How to get Header in Downloaded .xls file using GUI_Download function ???
How to use the the Header parameter available in GUI_Download function .HI,
see this sample code..
data : Begin of t_header occurs 0,
name(30) type c,
end of t_header.
data : Begin of itab occurs 0,
fld1 type char10,
fld2 type char10,
fld3 type char10,
end of itab.
DATA: v_pass_path TYPE string.
append itab.
itab-fld1 = 'Hi'.
itab-fld2 = 'hello'.
itab-fld3 = 'welcome'.
append itab.
append itab.
append itab.
append itab.
append itab.
t_header-name = 'Field1'.
append t_header.
t_header-name = 'Field2'.
append t_header.
t_header-name = 'Field3'.
append t_header.
CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
EXPORTING
default_extension = 'XLS'
IMPORTING
fullpath = v_pass_path.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = v_pass_path
filetype = 'DBF'
TABLES
data_tab = itab
FIELDNAMES = t_header
Cheers,
jose. -
Wanna skip exact number lines while reading a file file
Hi all,
I would like to skip exact number of lines while reading a text file.
Let's say I wanna read this text file starting from line no N.
And so I need to skip from fist line to N-1th line.
Does anyone give me a way to do?
Pls with a sample code if possible coz I am not familiar much to java. :PLineNumberReader class keeps track on line number for you. Sample that skip arg3 lines while copy arg1 file to arg2. Just sample no check, no cleanup.
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.LineNumberReader;
public class Main {
public static void main(String... args) throws Exception {
if (args.length != 3)
throw new IllegalArgumentException("Arguments: infile outfile line_from");
LineNumberReader reader = new LineNumberReader(
new FileReader(new File(args[0])) );
BufferedWriter writer = new BufferedWriter(
new FileWriter(new File(args[1])) );
int readFrom = Integer.valueOf(args[2]);
// skip first lines
while(reader.getLineNumber() < readFrom) {
if (reader.readLine() == null)
throw new IllegalArgumentException("Too few lines");
// write tail
String line = null;
while((line = reader.readLine()) != null) {
writer.write(line);
writer.newLine();
writer.flush();
} -
I am trying to write some code which will generate a file and then download the file
from my Webserver. When I download the file I get "Error 500: OutputStream already obtained"
appended to the file. I can't work out why this is so.
Here is the code I have used to download the file.
I have also included the file before and after transmission.
Any help would be appreciated.
<%@page import="java.net.*,javax.servlet.http.*,javax.servlet.*,java.io.*" %>
<%
ServletOutputStream out1 = response.getOutputStream();
String fileName = (String)request.getParameter("filename");
// MIME type for pdf doc
response.setContentType("application/x-download");
response.setHeader("Content-Disposition","attachment;filename="+fileName+";");
File f = new File("\\"+fileName);
FileInputStream stream = new FileInputStream(f);
BufferedInputStream bis = new BufferedInputStream(stream);
BufferedOutputStream bos = new BufferedOutputStream(out1);
byte[] buff = new byte[2048];
int bytesRead;
// Simple read/write loop.
try {
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
} catch (Exception e) {
if (bos != null) bos.close();
e.printStackTrace();
finally {
if (bis != null) bis.close();
if (bos != null) bos.close();
if (stream != null) stream.close();
%>
This is the file on the WebServer
The Quick Brown Fox Jumps Over The Lazy Dog
The Quick Brown Fox Jumps Over The Lazy Dog
The Quick Brown Fox Jumps Over The Lazy Dog
This is the file after it has been transferred
The Quick Brown Fox Jumps Over The Lazy Dog
The Quick Brown Fox Jumps Over The Lazy Dog
The Quick Brown Fox Jumps Over The Lazy DogError 500: OutputStream already obtained
Thanks
Adrian Campbell
Honda AustraliaThe JSP automatically gets an outputstream/writer, and starts writing to the output. In fact thats where the implicit variable "out" comes from.
Couple of things to be aware of:
Every carriage return outside of a <% %> tag in a JSP gets converted directly into the html as out.println("\r\n");
That means the generated servlet has started writing even before you get the outputstream - which is what raises the exception.
There are two ways to stop this
1 - write it in a servlet - its purely code, with no HTML so servlet is better suited.
2 - have no carriage returns outside of JSP tags <% %>. You currently have one - one the very first line. Try it like this:
<%@page import="java.net.*,javax.servlet.http.*,javax.servlet.*,java.io.*" %><%
ServletOutputStream out1 = response.getOutputStream();
%> // and no carriage return at the end eitherThat should do it.
As an aside, if you are going to be generating a text file, then you can use the implicit writer "out" as opposed to the OutputStream.
Cheers,
evnafets -
How to resolve damaged PDF file (via GUI_DOWNLOAD)
Dear forumers,
I am having problems with the GUI_DOWNLOAD method for downloading PDF files to the presentation server.
The SY-SUBRC code is 0, and the PDF file gets downloaded and saved in the presentation server.
However, opening any PDF files would be unsuccessful due to the error message that the file is damaged.
Text files on the other hand, are fine.
What could be wrong here, and how can I resolve this issue?
Appreciate any inputs here at all.
Many thanks.
P/S:
I had earlier tried this with GUI_DOWNLOAD FM, but with the same results as well - the issue still persists.
Attached here is the screenshot of the error message when opening a PDF file.Codes extract:-
*& Form download_all_attachments
* Download all attachments
FORM download_all_attachments .
DATA: lv_obj TYPE swotobjid-objkey.
DATA: lv_instid TYPE sibfboriid.
DATA: lv_classname TYPE bapibds01-classname.
DATA: lv_fol_id TYPE soodk.
DATA: lv_doc_id TYPE soodk.
DATA: lv_filename TYPE string.
DATA: lv_path TYPE string.
DATA: lv_fullpath TYPE string.
DATA: lv_path_tmp TYPE string.
DATA: lv_result TYPE i.
DATA: lv_sapusr_dir TYPE sdok_chtrd.
DATA: lv_directory TYPE string.
DATA: lwa_srgbtbrel TYPE srgbtbrel.
DATA: lwa_conn TYPE bdn_con.
DATA: lwa_errormsg TYPE iwerrormsg.
DATA: lt_srgbtbrel TYPE STANDARD TABLE OF srgbtbrel.
DATA: lt_conn TYPE STANDARD TABLE OF bdn_con.
DATA: lt_conn_tmp TYPE STANDARD TABLE OF bdn_con.
DATA: lt_objcont TYPE STANDARD TABLE OF soli.
FIELD-SYMBOLS: <lwa_final> TYPE zfidocattach.
CONSTANTS: lc_attach_field TYPE slis_fieldname VALUE 'ATTACH'.
CONSTANTS: lc_temp_path TYPE string VALUE 'C:\temp'.
CONSTANTS: lc_separate(1) TYPE c VALUE ';'.
CONSTANTS: lc_period(1) TYPE c VALUE '.'.
LOOP AT gt_final ASSIGNING <lwa_final>.
CLEAR: lv_obj, lv_instid, lv_classname,
lt_srgbtbrel, lt_conn, lwa_srgbtbrel.
CONCATENATE <lwa_final>-bukrs <lwa_final>-belnr <lwa_final>-gjahr
INTO lv_obj.
lv_instid = lv_obj.
SELECT *
FROM srgbtbrel
INTO TABLE lt_srgbtbrel
WHERE reltype = lc_attachment_rel
AND instid_a = lv_instid
AND catid_a = lc_borobj_ctgy.
SORT lt_srgbtbrel BY typeid_a.
DELETE ADJACENT DUPLICATES FROM lt_srgbtbrel
COMPARING typeid_a.
LOOP AT lt_srgbtbrel INTO lwa_srgbtbrel.
CLEAR lt_conn_tmp.
lv_classname = lwa_srgbtbrel-typeid_a.
CALL FUNCTION 'BDS_GOS_CONNECTIONS_GET'
EXPORTING
classname = lv_classname
objkey = lv_obj
client = sy-mandt
TABLES
gos_connections = lt_conn_tmp
EXCEPTIONS
no_objects_found = 1
internal_error = 2
internal_gos_error = 3
OTHERS = 4.
APPEND LINES OF lt_conn_tmp TO lt_conn.
CLEAR: lwa_srgbtbrel, lv_classname.
ENDLOOP.
LOOP AT lt_conn INTO lwa_conn.
MOVE lwa_conn-loio_id TO lv_fol_id .
MOVE lwa_conn-loio_id+17(25) TO lv_doc_id .
CALL FUNCTION 'SO_OBJECT_READ'
EXPORTING
folder_id = lv_fol_id
object_id = lv_doc_id
TABLES
objcont = lt_objcont.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL FUNCTION 'IW_C_GET_SAPWORKDIR'
IMPORTING
sapworkdir = lv_sapusr_dir
error_msg = lwa_errormsg.
IF sy-subrc = 0.
lv_directory = lv_sapusr_dir.
ELSE.
lv_directory = lc_temp_path.
ENDIF.
CONDENSE lv_directory.
* Filename format:
* Company code;YYMM(posting Date);Document number;Attach File name.ext
CONCATENATE <lwa_final>-bukrs lc_separate
<lwa_final>-budat(4) <lwa_final>-budat+4(2) lc_separate
<lwa_final>-belnr lc_separate
lwa_conn-descript lc_period lwa_conn-docuclass
INTO lv_filename.
IF lv_path IS INITIAL.
* Display save dialog window
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
default_extension = 'ASC'
default_file_name = lv_filename
initial_directory = lv_directory
CHANGING
filename = lv_filename
path = lv_path
fullpath = lv_fullpath
user_action = lv_result.
IF sy-subrc <> 0 OR
lv_result <> cl_gui_frontend_services=>action_ok.
EXIT.
ENDIF.
CHECK lv_result EQ '0'.
ELSE.
CLEAR: lv_path_tmp, lv_fullpath.
lv_path_tmp = lv_path.
CONCATENATE lv_path_tmp lv_filename
INTO lv_fullpath.
ENDIF.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
* bin_filesize =
filename = lv_fullpath
filetype = 'ASC'
* APPEND = SPACE
* write_field_separator = 'X'
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = SPACE
* WRITE_LF = 'X'
* COL_SELECT = SPACE
* COL_SELECT_MASK = SPACE
* DAT_MODE = SPACE
* CONFIRM_OVERWRITE = SPACE
* NO_AUTH_CHECK = SPACE
* CODEPAGE = SPACE
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = SPACE
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* IMPORTING
* FILELENGTH =
CHANGING
data_tab = lt_objcont
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* CALL FUNCTION 'GUI_DOWNLOAD'
* EXPORTING
* filename = lv_fullpath
* filetype = 'ASC'
** append = 'X'
* write_field_separator = 'X'
** confirm_overwrite = 'X'
* TABLES
* data_tab = lt_objcont
* EXCEPTIONS
* file_open_error = 1
* file_write_error = 2
* OTHERS = 3.
CLEAR lwa_conn.
ENDLOOP.
ENDLOOP.
ENDFORM. " download_all_attachments -
Inserting Field Names as Header while downloading the file
Hi,
I am downloading one file using CALL METHOD cl_gui_frontend_services=>gui_download and wanted to add field names as header while downloading.I have the filed names in one internal table and have written the code as follows:
LOOP AT gt_import INTO gw_import.
gw_fldname-field_name = gw_import-field_name.
APPEND gw_fldname TO gt_fldname.
ENDLOOP.
Here gt_fldname has the field names.
l_descr_ref ?= cl_abap_typedescr=>describe_by_data( gt_fldname ).
CLEAR : l_counter.
LOOP AT l_descr_ref->components[] ASSIGNING <lfs_comp_wa>.
l_counter = l_counter + 1.
ASSIGN COMPONENT sy-index OF STRUCTURE gt_fldname TO <lfs_comp>.
IF sy-subrc = 0.
<lfs_comp> = <lfs_comp_wa>-name.
ENDIF.
ENDLOOP.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = pdir1
filetype = text-038
append = ''
write_field_separator = 'X'
CHANGING
data_tab = <lfs_comp>
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0.
EXIT.
ENDIF.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
filename = pdir1
filetype = text-038
append = 'X'
write_field_separator = 'X'
CHANGING
data_tab = <gfs_table1>
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
not_supported_by_gui = 22
error_no_gui = 23
OTHERS = 24.
IF sy-subrc <> 0.
EXIT.
ENDIF.
But it goes to dump at l_descr_ref ?= cl_abap_typedescr=>describe_by_data( gt_fldname ) where I am trying to make the filed names horizontal.
Can anyone help on this?The issue has been resolved after writting:
l_ref_table ?= cl_abap_tabledescr=>describe_by_data( gt_fldname ).
l_descr_ref ?= l_ref_table->get_table_line_type( ).
Thanks. -
Error while downloading a file
I have written a servlet that downloads a file from my server on to my mobile.
i have written the following code to download the file:
URL url = new URL(path);
URLConnection connection = url.openConnection();
InputStream stream = connection.getInputStream();
BufferedInputStream in = new BufferedInputStream(stream);
FileOutputStream fos = new FileOutputStream(fileName);
BufferedOutputStream out = new BufferedOutputStream(fos);
int i;
while ((i = in.read()) != -1)
//System.out.println("Reading the file");
out.write(i);
out.flush();The code has no errors, but i m unable to download the file. The mobile gives me an error saying:
Services: Empty File
Can anyone please help me out with this problem.
with regards,
ShirishThis way to download files from server looks odd. You're issuing a new URL connection, likely to self. This may be slower than accessing the file directly using FileInputStream.
But anyway, you haven't set the contenttype and contentlength accordingly. Likely the mobile is aborting the download immediately since the headers have sent a contentlength of 0 bytes.
Check at the bottom of http://balusc.xs4all.nl/srv/dev-jep-pdf.html for some downloadFile() snippets, which might provide useful insights how to download files. -
Displaying message in JApplet while downloading a file
hi
In my applet Im trying to download a file from server to client while downloading i want display progressbar/ msg
when i try to do this my applet GUI dosnot loads untill that file download complete and i tried with a button so that ofter clicking on it download should start, in this case also the masg doesnot changes according to given setText method for that Jlabel.while output message to console is printing properly.
even i have tried with generating new thread to set Jlabel text message. that also doesnot worked
here im going to paste my code part of applet could anybody tell me what wrong in my code / else what could be done..?
client machine is windows XP
public void init()
Container Contentpane=getContentPane();
Contentpane.setLayout(null);
textpanel = new JPanel();
textpanel.setLayout(null);
textpanel.setBounds(10,40,250,200);
msg=new JLabel();
msg.setBounds(5,5,200,150);
textpanel.add(msg);
getContentPane().add(textpanel);
public void start()
msg.setText("<html>Downloading File to System...<html>");
URL inFileURL=new URL(getCodeBase()+"/load/My.dll");
System.out.println(" opening connection- ");
URLConnection urlfl=inFileURL.openConnection();
urlfl.setDoInput(true);
urlfl.setDoOutput(true);
urlfl.setUseCaches(false);
urlfl.setRequestProperty("Content-Type", "application/octet-stream");
int sz=urlfl.getContentLength();
System.out.println(" Total Length ... " +sz);
BufferedInputStream inFile1 = new BufferedInputStream (urlfl.getInputStream(),urlfl.getContentLength());
int succesbytes = 0;
int current_read;
byte[] strMsg11 = new byte[urlfl.getContentLength()];
int readrs;
BufferedOutputStream outfl =new BufferedOutputStream(new FileOutputStream("c:\\My.dll"));
while(inFile1.available() > 0)
current_read =inFile1.read(strMsg11,0,urlfl.getContentLength());
System.out.println(" Current Read = "+current_read);
succesbytes += current_read;
outfl.write(strMsg11,0,current_read);
msg.setText("<html>"+successbytes+" bytes downloaded successfully..<html>");
System.out.println("Written ... = " +succesbytes );
outfl.flush();
outfl.close();
} //end of start
thanks in advance
Edited by: Hegde on Oct 6, 2007 6:48 AMHi Vic,
Please post in ASP.NET forums.
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. -
Getting Exception in JWS while downloading jar files from server
Hi All,
I am running JWS on j2re1.4.2_10(build 03). while JWS is trying to download jar files from web server, I am getting the following Exception.
All the jar files are signed. Any idea ?
JNLPException[category: Download Error : Exception: null : LaunchDesc: null ]
at com.sun.javaws.cache.DownloadProtocol.doDownload(Unknown Source)
at com.sun.javaws.cache.DownloadProtocol.getDownloadSize(Unknown Source)
at com.sun.javaws.LaunchDownload.downloadJarFiles(Unknown Source)
at com.sun.javaws.LaunchDownload.downloadEagerorAll(Unknown Source)
at com.sun.javaws.Launcher.downloadResources(Unknown Source)
at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)Are you able to download your *.jar files directly from server
For example say,
http://127.0.0.1:8080/test/testme.jarIf yes,
Then problem should be with your *.jnlp file. Check all your *.jar with respect to context location of your url from where you are downloading *.jnlp file
Maybe you are looking for
-
I can't open i Tunes. Message: This version of i Tunes has not been correctly localized for this language. Please run English version. Why did this happen and how do I correct so I can open and use i Tunes again?
-
My uploads to Facebook fail with Unknown Error
Every attempt to upload my projects to Facebook fail with the message "Error, Unknown Error" message. I have tried projects from 15 down to just 5 minutes. I have tried projects with 6 down to just 1 clip. I have tried wireless and wired connections.
-
Authorization Objects in BI 7.0
Dear friends, I am on a brand new implementation and there is no lead, secuerity or basis here.I am the only BI developer. I read the info on sdn and couldnt piece it all together.I rely on your expertise so please help. For myself as a BI dev (prime
-
Can't connect to IPv6-only host from java on Mac OS
I have some IPv6-only hosts. I can successfully execute curl request to it by curl $ curl -I my.ip.v6.only.host HTTP/1.1 200 OK But when I trying to get it from java I have an error: HttpGet httpget = new HttpGet("http://my.ip.v6.only.host"); Closeab
-
Premier Pro 1.5 will not boot up in Windows 7
Just bought a new Dell XPS8100 with windows 7 home premium edition and installed Premiere Pro 1.5. Install seemed to go fine, but when you try and run the program it hangs when loading GPUPageCurlAEX.