WLS 5.1 w/sp8 garbeling binary files when uploaded.

I have implemented multiple methods of handling file uploads in servlets.
          I have tried the Marsh:
          http://sourceforge.net/projects/marsh/
          and the Oreilly com.oreilly.servlet:
          http://www.servlets.com/cos/index.html
          helper libraries as well as my own code, yet I still have the same problems.
          For some reason some bytes in binary files are being converted to ascii '?'s
          instead of the proper bytes. All uploaded files from all three
          implementations contain the same error, yet no bugs are listed in any of
          them (even Weblogic.)
          I am running WLS 5.1 SP8 on Windows and Linux and am having the same errors
          on both. If you might be thinking it's the way I'm writing the file then
          here is how I am outputing (once I get an input stream from the
          HttpServletRequest).
          /* Code snippet */
          x = myinput_stream.read();
          while(x >= 0) {
          myfile_writer.write(x);
          x = myinput_stream.read();
          myfile_writer.close();
          /* End code snippet */
          If you know how to fix this or you have gotten WLS to upload binary files at
          all then please reply and let me know.
          

I'll try that and then let you know....
          "Dimitri Rakitine" <[email protected]> wrote in message
          news:[email protected]...
          > Writer's are for character streams - it will work if you use OutputStream
          > to write to a binary file.
          >
          > Hoopy Hacker <[email protected]> wrote:
          > > I have implemented multiple methods of handling file uploads in
          servlets.
          >
          > > I have tried the Marsh:
          >
          > > http://sourceforge.net/projects/marsh/
          >
          > > and the Oreilly com.oreilly.servlet:
          >
          > > http://www.servlets.com/cos/index.html
          >
          > > helper libraries as well as my own code, yet I still have the same
          problems.
          > > For some reason some bytes in binary files are being converted to ascii
          '?'s
          > > instead of the proper bytes. All uploaded files from all three
          > > implementations contain the same error, yet no bugs are listed in any of
          > > them (even Weblogic.)
          >
          > > I am running WLS 5.1 SP8 on Windows and Linux and am having the same
          errors
          > > on both. If you might be thinking it's the way I'm writing the file
          then
          > > here is how I am outputing (once I get an input stream from the
          > > HttpServletRequest).
          >
          > > /* Code snippet */
          > > x = myinput_stream.read();
          > > while(x >= 0) {
          > > myfile_writer.write(x);
          > > x = myinput_stream.read();
          > > }
          > > myfile_writer.close();
          > > /* End code snippet */
          >
          > > If you know how to fix this or you have gotten WLS to upload binary
          files at
          > > all then please reply and let me know.
          >
          > --
          > Dimitri
          

Similar Messages

  • I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

    I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

    I am shooting with a Nikon D60 on Fine Format and unable to print larger than 11x14.  I have been able to print larger pictures.  I am told iPhoto reduces the size of the file when uploaded. Is this true? If so how can I change this?  I need 16x20's

  • Disable "Overwrite existing files" when upload doument

    Dear team,
    in document library, when upload document, i don't want the document to overwrite the documents with the same name.
    there is chekbox in upload page, that is default checked, I searched and some people said that I can update the upload page, find the checkbox control, and set the value to false, so i update the value in Upload.aspx and Uploadex.aspx page to change the
    value.
     but after changing the value, I cannnot open the upload page successfully, it always shows error.
    Did I do anything wrong?

    Hi Greetings.
    This is not the right procedure
    Scording to your post, my understanding is that you wanted to override SharePoint OOTB Upload.aspx default for " Overwrite existing files" checkbox.
    We can use the AdditionalPageHead delegate control to change the default without modifying upload.aspx.
    There is an article for your reference, although it is about the WSS3.0, it still works for SharePoint 2013: Turn Default Upload Overwrite Off in WSS 3.0
    Please follow the steps as below:
    Download the solution file form here
    Copy the wps file to the Disk C.
    Open the SharePoint 2013 Management Shell.
    Run the command: add-spsolution c:\ DefaultUploadOverwriteOff.wsp
    Open the Center Administration, click System Setting->Manage Farm Solution-> dp.sharepoint.workflow.wsp->Deploy to one or more Web Application.
    Open the site, clilck Site settings-> Site collection features-> Default Upload Overwrite Off->Active.
    Open the library, the 'overwrite existing files' checkbox will be unchecked.
    Source Link http://social.technet.microsoft.com/Forums/office/en-US/0a94c70b-20e5-4cee-93e2-fbaf50a9ac07/removing-the-overwrite-existing-files-checkbox-which-appears-when-uploading-a-new-document-in?forum=sharepointgeneral
    Please remember to click 'Mark as Answer' on the answer if it helps you

  • .jpg files created on iphone 4S are not recognized as .jpg files when uploading them to American Heart Assoc. website?

    .jpg files created on Iphone 4S are not recognized as .jpg files when uplaoding to American Heart Association fund raising webpage? .jpg's from Canon camera uploaded without any problems? The website automatically reduces the file size to <100kb.

    I haven't contacted AHA about this issue. The .jpg files created on Canon SLR uploaded correctly, but the photo from iPhone which was emailed to my PC using MS IE. The .jpg was browsed to from my desktop and is submitted. It shows up in draft form then when uploading it fails saying it is not a .jpg file or .png file? I have had other issues in the past emailing iPhone pictures. They were not editable after being sent to a PC. I guess we can retake photos with a non-Apple camera.

  • Dreamweaver CC not prompting to put dependent files when uploading ColdFusion .cfm files?

    I just 'upgraded' (if you consider DW CC an upgrade) from CS6 to CC, and am having problems with .cfm files.
    I have followed all the instructions to get DW CC to open and edit .cfm files..... and it does this just fine. I have also installed the server behaviours and databases panel extension.
    However heres the BIG problem: when I want to upload a .cfm file to a server, I am no longer getting a prompt to upload dependent files! It prompts me fine if I upload a .html file, but not .cfm.
    I mostly work with .cfm files and make changes to CSS files regularly. Whenever I upload a .cfm it is essential that DW also uploads the dependent files associated with it.
    Please how can I fix this issues? I have gone into preferences and all the boxes are checked correctly to prompt for dependent files when putting/getting. I'm so stuck I'm thinking about cancelling my CC products and going back to CS6.

    I have now discovered that DW CC does not prompt to upload dependent files if the file extension is .CFM or .ASPX.
    This is seriously frustrating Adobe..... !!!

  • Where is the name of the file when upload in UIX

    Hi, I'm using ORDSYS.ORDDoc as column type of my upload file colum, because is the only way to do upload with UIX without programming. All is Ok with this type of colum (I wish to do the same with blobs), but I have a problem: where is the name of the file? I need to get the name, I read about one attribute for this, somebody know about it?
    Thanks.

    Hi,
    but I made all automatic with UIX, I need that the link when I listing this colum, don't say a fixed name, I want that this link save the file with the original file name. 2 things, maybe when the file was saved, the info about the original name not was saved too, or the method that write the link, don't use this name, only a fixed name.
    Thanks.

  • Word cannot open file when uploaded document to document library progrmmatically.

    I have created one button in which I am uploading a new document to document library through my code. The document library contains document template.
    My code is as below:
    private SPListItem CreateDocument(SPList Docs, string title)
    SPListItem newItem = null;
    try
    SPFolder cmsDocsFolder = Docs.RootFolder;
    SPFileCollection fileCollection = cmsDocsFolder.Files;
    if (!string.IsNullOrEmpty(Docs.ContentTypes[0].DocumentTemplateUrl))
    string docTemplateUrl = Docs.ContentTypes[0].DocumentTemplateUrl;
    SPFile docTemplateFile = Docs.ParentWeb.GetFile(docTemplateUrl);
    byte[] binaryFile = docTemplateFile.OpenBinary();
    string newFileUrl = cmsDocsFolder.Url + "/" + RemoveSpecialCharacters(title).Trim() + _docxExt;
    if (!Docs.ParentWeb.GetFile(newFileUrl).Exists)
    SPContentType contentType= Docs.ContentTypes.Cast<SPContentType>().FirstOrDefault(c => c.Id.IsChildOf(ContentTypeIDs.CMSDocument));
    if (contentType != null)
    SPFile addedFile = fileCollection.Add(newFileUrl, binaryFile, false);
    newItem = addedFile.Item;
    newItem[FieldNames.ContentTypeId] = ContentTypeIDs.CMSDocument;
    newItem[FieldNames.ContentType] = contentType.Name;
    catch (Exception ex)
    return newItem;
    My code does not throw any error but when I go to document library and click on uploaded document the file tries to open in word application but I am getting an error:
    "Word cannot open the file because the file format does not match the file extension. (url)"
    The browser I am using is FF.
    What am I missing? Please help.

    Hi,
    Please try to upload your document using SharePoint UI.
    If the issue still exists in Firefox, I suggest you check your Firefox settings.
    If not, please debug your code and watch the value or here is a blog for your reference:
    http://thearkfloats.blogspot.com/2013/10/programmatically-upload-to-sharepoint.html
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Dreamweaver 6 corrupts files when uploading via Dreamweaver ftp tool

    When I use Dreamweaver to upload a file very often something gets corrupt. Javascript ceases to work. The page runs locally and javascript works. The file is fine when I upload with a different ftp tool (fetch, Transmit, etc).
    When I view the source of the non-working file the code looks all garbled.
    When I upload the file witha diftterent ftp tool, all is well.
    Never saw this before. What's up?
    Using Mac, Lion, latest versions.

    You can see a sample page here
    The js is a simple date script I've been using for years.
    Check out the formatting change after the upload with CS6 - This ONLY happens with CS6.
    Server - Linux,  apache 2.2.22
    Local - iMac 2.8ghz core i7 OS 10.8

  • Skip file when uploading entire site

    Is there a way to skip one file or more during uploading? Say I am uploading the entire site and when I come to a big video file I'd like to skip this file...

    Hi
    Cloak the file(s) before selecting to upload the entire site.
    Select the file - right click - select cloaking.
    PZ

  • Unreadable files when uploading photos from iphone 4s?

    I have been trying to upload photos from my iphone 4s which I took recently onto my mac laptop and they seem to be unreadable and aren't uploading for some reason?
    Any help appreciated.

    If you want help you’ll need to give us more information. There are 9 different versions of iPhoto and they run on 8 different versions of the Operating System. The tricks and tips for dealing with issues vary depending on the version of iPhoto and the version of the OS. So to get help you need to give as much information as you can. Include things like:
    - What version of iPhoto.
    - What version of the Operating System.
    - Details. As full a description of the problem as you can. For example, if you have a problem with exporting, then explain by describing how you are trying to export, and so on.
    - History: Is this going on long? Has anything been installed or deleted? - Are there error messages?
    - What steps have you tried already to solve the issue.
    - Anything unusual about your set up? Or how you use iPhoto?
    Anything else you can think of that might help someone understand the problem you have.

  • Issue in downloading Binary File on Safari 5 (MAC OS)

    Hi,
    We are working on an application, which download binary file when clicks the button, when i am using Safari 6 the below code snippet download file successfully.
    Image:
    Safari 6: on clicking Export file downloaded:
    code:
    String userAgent = request.getHeader("user-agent");
                if (userAgent.toLowerCase().indexOf("mac") >= 0) {
                    response.setContentType("application/octet-stream");
                } else {
                    response.setContentType(TEXT_CSV);
                // These Lines were added to make it work on the secure https
                // connection
                response.setHeader("Pragma", "public");
                response.setHeader("Cache-Control", "max-age=0");
                response.setHeader("Content-Disposition", "filename=contacts.csv");
    but when we use safari 5 on MAC its not downloading the file, it simply display the content on browser it self
    Image:
    and file is not downloaded in this case, can some one tell what should be the contentType(""); should be set to download the file in Safari 5, so that the file can be downloaded in case of Safari 5.
    Thanks in advance:)

    You can set content type to:
    response.setContentType("application/vnd.ms-excel");
    file will download on safari 6

  • Multipart request is garbled in case of binary file (excel)

    Hi,
    I am having problem in uploading file in our portal application.
    Setup:
    We have a 10g portal server (10.1.0.4). Authentication is done using coreid.
    We have a http apache server hosted on a different machine with webgate plugin protecting all the request. Coreid is hosted on a different machine. So we have three machines, one for http server, one for portal server and one for coreid. The request is SSL request.
    When I submit a multipart request, I am not able to upload the file. When I printed the whole request in a file, I could see header of file item (which contains filename, content type etc.) is getting stripped off. Not only this, any html element above "file" element in the form is also stripped off. This happens only in case of binary file. Uploading text files works fine.
    Above case is when I submit the request to http apache server.
    Now if I submit the multipart request directly to portal server, file upload works fine, both for text and binary (excel).
    What is different in these two cases:
    In case of first case request is going thru http server and webgate. SSL is configured in http server, so request is SSL request.
    In second case, submitting directly to portal server, the request is not over SSL.
    Please help me solving this problem.
    Help is greatly appreciated.
    Regards,
    Rana Biswas

    Would like to add another thing, the problem is not limited to portal application. I created two simple jsps one form and another to receive the multipart request and deployed it in a separate application, which is NOT a portal application.
    Same problem is there.
    Regards,
    Rana Biswas

  • Read binary files that are wraped in the downloaded executable signed jar

    Hello, there:
    I have created a Swing application and created a signed jar file and uploaded it to my site. The signed jar includes class packages, and a folder of binary files which are the datasource for my application.
    jws downloads this signed executable jar, it'll automatically run it, but it has problems reading the binary folders wrapped in itself (the app is supposed to read the folder's structure and use the info to create a JTree object, and read the file's content as well). Is it the file path conversion problem? Do we need to use URL instead? I tried it after reading some threads on this forum but didn't make it.
    As an alternatives, I want JWS to unjar the jar file and expand it to exploded files. I manually unjar it and run the app from command line, it works fine.
    Plus, the app is supposed to manipulate the binary files when it's in process, like saving new content back to the files, zip the files and upload them to the remote sql server. therefore, I think it's easy to have it run when it's expanded.
    So here is the question: JWS by default is running the executable jar, is there a way to tell JWS to unzip the jar and find the main class in the exploded files and run it?
    Thanks a lot for your suggestions,
    Sway

    You can get to any resource in a jar file in your classpath. The code below will return InputStream for resource.bin nested two packages down.
    InputStream in = YourClass.class.getResourceAsStream("/com/mypackage/resouce.bin");  //use '/' instead of '.'You can open a FileOutputStream to write that file.
    OutputStream out = new FileOutputStream("myTempResource.bin");
    IOUtil.streamAndClose(in,out);If the resouce is a nested zip or nested jar then you can use the Java Zip utilities to unwrap the stream.

  • Wrong embedded colour profile causes huge jpg files when published to .Mac

    D'oh! i posted the following on the iDisk discussion my mistake. Here it is all again for iWebbites:
    I've spent most of the day trying to optimise my new iWeb site on .Mac but the published jpg files are far too big.
    Despite sizing to 800x600 px and jpegging at about 5 or 6 in Photoshop which resulted in a file size of about 100kb on my local disk, when uploaded to .Mac via iWeb the they have turned into 800 kb files.
    Lots of trouble-shooting, including ensuring that they weren't converted to png, that they have no borders, reflections or drop-shadows yet they still got bloated on the upload. Especially the photos in the photo-gallery page.
    I've isolated the problem but don't know what to do next:
    Turns out, iWeb ignores the sRGB embedded colour profile and replaces it with the monitor profile of the originating computer.
    I discovered this after I opened the file in Photoshop directly via iDisk in Finder. Converting or assigning the file to sRGB and saving it back down to iDisk immediately restored it to its intended file size of 100kb and this time with the correct sRGB colour profile.
    Going now to the domain.sites on my local disk and opening the package shows all the photos doubled up. A 360 x 264 .jpeg file with the monitor profile embedded and bloated out to 800kb plus the original 800x600 image with sRGB and .jpg as the file type but still only 100kb
    So what the heck is happening in iWeb to do this and to use the wrong file type associations with the wrong file when uploaded?
    There is very little on the forum about colour (color) profiles and no mention of the bloat in file size, just a reference to colour and tone issues with the wrong profile so I'm wondering if its related to the 1.1.2 update. (I haven't really tried using iWeb until the last week or so).
    Fixing the problem by post processing the photos on my site every time I publish would be impossible with the amount of photos I have and my intention of updating the web galleries regularly.
    As you can find out if you go to a photo page on my site:
    < <a class="jive-link-external-small" href="http://">http://web.mac.com/adrian_malloch/iWeb/AdrianMallochPhotography/ Kabaddi.html > some pages take horrendously long to load. Check out some of the other Subculture pages. I haven't tested them all but Safari Activity viewer shows that most of the slow speed is related to opening jpeg files.
    Any help and informed suggestions would be hugely appreciated.

    This is doing my head in.
    My last two comments "posted" half way through writing, before I had a chance to edit completely.
    Here's how it should have read :
    Using sRGB as a monitor profile, in itself, doesn't make a lot of sense.
    A monitor profile is custom made specifically for the monitor to compensate for its display characteristics.
    A "good enough" monitor profile is to use the software calibration built into the Displays preferences. Go to System Preferences/Displays/Color/Calibrate and follow the prompts. Hint: squint as you try to judge the colour and tone differences. The idea is to make the detail so fuzzy you don't notice it.
    It's not very accurate, especially with LCD screens, but it's better than nothing and certainly better than using a universal colour space like sRGB, etc.
    The accurate option is to get hold of a hardware calibrator like the Spyder, or Gretag-McBeth iOne Display (which I use). It costs a bit but is vital for accurate repeatable colour.
    The whole point is that when the profile is made up and is set as the default profile, then you will get a WYSIWYG screen.
    So, the same images will look the same on different monitors providing they each have accurate monitor profiles made specifically for them.
    If you use sRGB as your monitor profile then you cannot expect the image to look the same on any one else's machine, whether they use sRGB, a monitor profile or any other profile. Worse still, if you change an image to "look right" on your screen, chances are that the image will look horrible on another screen.
    Hence, why I will only switch to sRGB monitor profile as a workaround for uploading in iWeb. Nothing else!!

  • How to zip a file before uploading?

    I know we don't have much control when uploading files, but can we zip files when uploading them from a Flex application?
    Any code examples or links to such?
    Thanks,
    Greg

    hi,
    The mars project includes flex code to enable the creation of adobe openPDF containers, these containers are zip files, you can stream any flex object into a 'container'  which is actually a zip file, for instance I can take an xmldocument, stream it into the zip stream as xmldoco.xml then save that stream to mytest.zip. Use any zip program and you will see you have a compressed text file in mytest.zip called xmldoco.xml. The original question was about creating a zip file, the mars project flex classes allow you to do this.
    http://download.macromedia.com/pub/labs/mars/mars_sampleapp_air_051608.zip - look at the flex zip classes in this file
    The only reason that the flex mars application was done in air was due to the fp 9 local file access limitations with fp 10 that no longer applies.
    http://labs.adobe.com/technologies/mars/ read comment 7 at the bottom of this webpage
    "You can open a PDFXML file with any Zip tool or the PDFXML Inspector, which allows you to display the file contents and make simple edits."
    David.

Maybe you are looking for