Upload image files to server

I am writing a web page using apache tomcat and java servlets. I want to be able to upload image files to a server directory. Can somebody show me the code or an example in completing this task.

Easiest way to do it is to use a library like [Jakarta commons FileUpload|http://commons.apache.org/fileupload/]
[A useful reference|http://balusc.blogspot.com/2007/11/multipartfilter.html]

Similar Messages

  • How to upload image files in sqlserver from jsp

    hi friends,
    i want to upload images to sqlserver how will i store url of the image or dorectly store the file in binary format, if we store in related path,plese give some ideas on store that paths in data base and how we store that image files in user directories.
    bye

    hi jay , I know that concept , but i dont know how to upload image files to server Please help me
    here i am giving my problem
    If any user register with site, he has the option to upload his image to the site, so i am using in html file upload option, But i dont know how to store that iamge into the server
    please give me suggestion
    regards
    sudhakar

  • How can i upload a image file to server by using jsp or servlet.

    Hi,
    I m gurumoorthy. how can i upload a image file to server by using jsp or servlet without using third party API. pls anyone send me atleast outline of the source code.
    Pls send me anyone.
    Regards,
    Gurumoorthy.

    I'm not an applet programmer so I can't give you much advice there.
    If you want to stream the file from the server before it's entirely uploaded, then I don't believe you can treat it like a normal file. If you're just wanting to throw it up there and then listen to it, then you can treat it like a normal file.
    But again, I'm not entirely certain. You might be able to stream the start of the file from the server while you're still uploading the end of it, but it probably depends on what method you're using to do the transfer.

  • Upload failed your changes were saved but could not be uploaded because of an error. you may be able to upload this file using server web page. save a copy

    Hi All,
    upload failed your changes were saved but could not be uploaded because of an error. you may be able to upload this file using server web page. save a copy button.
    This is the issue which I am facing while working with SharePoint 2010. In a sharePoint 2010 document library I am having an excel file and I am trying to open it from Windows 7 and is office 2010.
    I cam e across few suggestion as mentined below but unable to find the location where to do
    Go to Resource Policies > Web >
    Rewriting > Custom Headers > (if 'Custom Headers' is not visible, click
    Customize on the right top to enable the view).
    Create a new policy with the Resource as <fully qualified domain name of the SharePoint server:*/*> (for example https://sharepoint.juniper.net:*/* ).
    Create the action as Allow Custom Headers.
    Apply the settings to the required roles.
    Please suggest.

    Hi rkarteek
    All things you have to do is as follows:
    1. Open regedit.exe
    2. Naviagate to following key:
    [HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\14.0\Common\Internet]
    3. Click Edit Menu -> New -> DWORD with name of "FSSHTTPOff"
    (without quotes)
    4. Click on "FSSHTTPOff" and enter value of 1
    5.
    Close any Office Applications and browser sessions
    6. Try to reopen your document (no more read only or failure to upload)
    have a nice day!

  • Uploading a file to server using servlet (Without using Jakarta Commons)

    Hi,
    I was trying to upload a file to server using servlet, but i need to do that without the help of anyother API packages like Jakarta Commons Upload. If any class for retrieval is necessary, how can i write my own code to upload from client machine?.
    From
    Velu

    <p>Why put such a restriction on the solution? Whats wrong about using that library?
    The uploading bit is easy - you put a <input type="file"> component on the form, and set it to be method="post" and enctype="multipart/form-data"
    Reading the input stream at the other end - thats harder - which is why they wrote a library for it. </p>
    why i gave the restriction is that, i have a question that <code>'can't we implement the same upload'</code>
    I was with the view that the same can be implemented by our own code right?

  • Uploading image file using tcode se78  occuring some   Error

    Hai Gurus
          I am uploading image file using tcode se78 but while Uploading it giving some error i cant resolve the problem so any one help me plz
    Error    "Graphic LOGO could not be saved (2LOGO)"
    Regards
    Selvendran

    Hai
    Thanks
    I had done in all method but i can't save it 
    error is coming ..so plz help me to upload the image
    Error "Graphic LOGO could not be saved (2LOGO)"
    Regards
    Selvendran

  • How to upload a file into server using j2ee jsp and servlet with bean?

    How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
    Anyone help me please!

    u don't need j2ee and struts to do file uploading. An example is as such
    in JSP. u use the <input> file tag like
    <input type="file"....>You need a bean to capture the file contents like
    class FileUploadObj {
        private FormFile srcFile;
        private byte[] fileContent;
        // all the getter and setter methods
    }Then in the servlet, you process the file for uploading
        * The following loads the uploaded binary data into a byte Array.
        FileUploadObj form = new FileUploadObj();
        byte[] byteArr = null;
        if (form.signFile != null) {
            int filesize = form.srcFile.getFileSize();
            byteArr = new byte[filesize];
            ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
            bytein.read(byteArr);
            bytein.close();
            form.setFileContent(byteArr);
        // Write file content using Writer class into the destination file in the server.
        ...

  • Uploading zip file to server

    Hi,
    I want to upload a zip file in some server location,till now i have below code,but not able to get any clue how to upload zip file to server when user press Begin button.
    Can someone please help me?
    >
    JSP code:
    <af:inputFile label="Upload:"
    valueChangeListener="#{ifarm.fileUploaded}"/>
    <af:commandButton text="Begin"/>
    Bean code :
    public void fileUploaded(ValueChangeEvent valueChangeEvent) {
    UploadedFile file = (UploadedFile) valueChangeEvent.getNewValue();
    if (file != null)
    System.out.println("************** "+file.getFilename().toString());
    >>

    All you need to do is to get hold of the input stream of the upload file and copy it to an file on your server (which you can create).
        public static int copy(InputStream input, OutputStream output)
                throws IOException {
            byte[] buffer = new byte[1024 * 4];
            int count = 0;
            int n = 0;
            while (-1 != (n = input.read(buffer))) {
                output.write(buffer, 0, n);
                count += n;
            return count;
        public void fileUploaded(ValueChangeEvent valueChangeEvent) {
            UploadedFile file = (UploadedFile)valueChangeEvent.getNewValue();
            if (file != null) {
                File ff;
                try {
                    // create a temporary file on the host server
                    ff = File.createTempFile("xx", "yy");
                    FileOutputStream os = new FileOutputStream(ff);
                    IOUtils.copy(file.getInputStream(), os);
                } catch (IOException e) {
                    e.printStackTrace();
                System.out.println("************** " +
                                   file.getFilename().toString());
        }Timo

  • How to Upload a File to Server(JSP - Tomcat)?

    Hi,
    I want to upload a file to Server(Where the Tomcat is Running) to a particular directory.Let it be \tomcat\webapps\exapmles\Viki\.But note i dont have rights to map the drive from CLient side.I want to upload the file from client side to the unknwn server to a particular directory
    Please Help me
    Thanks in advance

    http://jakarta.apache.org/commons/fileupload/

  • How to save uploaded image file to Apache Web Server from Tomcat

    Hi guys,
    Perhaps this is not an appropriate topic to ask under this forum but I really don't know where should I post my question. Hope you understand.
    Ok, I need to know if my web application is running in Tomcat5 and user uploading some image file where I need to save these image files to the other server, which is running Apache Web Server. Should I ftp to there or other better method ?
    Anyone got a better idea on doing this kind of process pls advice. Many Thanks !
    regards,
    Mark

    if your Apache server is running in the same computer and if your servlet have write access to the folder in apache under which you want to save the file you can just write the file there but you will have to address concurrency issues.
    Otherwise you will have to do ftp but since apache does not have abuilt in frp server you will need a seperate FTP server for this

  • Uploading a image file to server

    hi,
    In client side i am choosing a image file or text file(using input type file in jsp)
    with full path.I want to save this file on server side.how to do this.please help me.

    http://search.sun.com/search/onesearch/index.jsp?qt=file+upload+servlet&rfsubcat=&col=developer-forums

  • Question about image preview in client side before upload the image file to server

    Hi everyone:
    My project has an image upload function. Currently it only display a fileupload component, after user press OK, the file will upload to server, but there's no preview before user press OK.
    I want it can show the preview, I know that I can upload the file to a temporary directory on server then show that image to client, but in this way will cause strain on server. Is there any other ways to preview the image? Like using JavaScript? Thankyou.

    Stuck with BMP

  • Images of gallery doesn't load when I upload the files on server

    The gallery works fine when the files is on my computer but when I upload the files on my server the images doesn't load.
    I'm using xml file to load the images. Here is the code of the gallery:
    function loadPlayList(url:String) {
              delete myMO.onMouseWheel;
              delete myKO.onKeyDown;
              for (var i in infostruc) {
                        root["_ref"+i] = root["_bmd"+i]=false;
              loadedAll = false;
              infostruc = [];
              for (var i in root) {
                        if ((root[i]._name.substr(0, 3) == "art" || root[i]._name.substr(0, 10) == "reflection") && (parseInt(root[i]._name.split("art")[1]) || parseInt(root[i]._name.split("reflection")[1]))) {
                                  root[i].swapDepths(root.getNextHighestDepth());
                                  root[i].removeMovieClip();
              current = 1;
              root.createEmptyMovieClip("loader", root.getNextHighestDepth());
              xmlData.load(url);
    function init(Void):Void {
              myMO = {};
              myKO = {};
              Mouse.addListener(myMO);
              Key.addListener(myKO);
              for (var i in infostruc) {
                        loader.clear();
                        loader.gradient_mc.removeMovieClip();
                        loader.attachMovie("default", "art", 1);
                        root["_shelveCDWidth"+i] = shelveCDWidth;
                        root["_shelveCDHeight"+i] = shelveCDHeight;
                        root["_frontCDWidth"+i] = frontCDWidth;
                        root["_frontCDHeight"+i] = frontCDHeight;
                        this["_bmd"+i] = new BitmapData(loader._width, loader._height);
                        this["_ref"+i] = new BitmapData(loader._width, loader._height);
                        this["_bmd"+i].draw(loader);
                        var mc:MovieClip = loader.createEmptyMovieClip("gradient_mc", loader.getNextHighestDepth());
                        matrix = new Matrix();
                        matrix.createGradientBox(loader._width, loader._height, reflectionRotation/180*Math.PI, 0, 0);
                        mc.beginGradientFill(reflectionFillType, reflectionColors, reflectionAlphas, reflectionRatios, matrix, reflectionSpreadMethod, reflectionInterpolationMethod, reflectionFocalPointRatio);
                        mc.moveTo(0, 0);
                        mc.lineTo(0, loader._height);
                        mc.lineTo(loader._width, loader._height);
                        mc.lineTo(loader._width, 0);
                        mc.lineTo(0, 0);
                        mc.endFill();
                        loader.art._alpha = reflectionAlpha;
                        loader.beginFill(reflectionBackgroundColour);
                        loader.moveTo(0, 0);
                        loader.lineTo(0, loader._height);
                        loader.lineTo(loader._width, loader._height);
                        loader.lineTo(loader._width, 0);
                        loader.lineTo(0, 0);
                        loader.endFill();
                        this["_ref"+i].draw(loader);
              for (var i:Number = count=0; count<stageWidth-(centerDistance*3); count += shelveCDSpacing, i++) {
                        var cArt:MovieClip = this.createEmptyMovieClip("art"+this.getNextHighestDepth(), this.getNextHighestDepth());
                        var rArt:MovieClip = this.createEmptyMovieClip("reflection"+(this.getNextHighestDepth()-1), this.getNextHighestDepth());
                        rArt.id = cArt.id=rArt.cid=cArt.cid=Number(i)+1;
                        rArt._x = cArt._x=stageWidth;
                        cArt.DistortImage(this["_bmd"+cArt.id]);
                        controlTheObject(cArt);
                        rArt.DistortImage(this["_ref"+cArt.id]);
                        controlTheObject(rArt);
                        var tmpFilter:BlurFilter = new BlurFilter(reflectionBlurX, reflectionBlurY, reflectionQuality);
                        rArt.filterArray = cArt.filterArray=[];
                        rArt.filterArray[0] = tmpFilter;
                        rArt.filters = rArt.filterArray;
                        tmask = mask.duplicateMovieClip("_mask"+cArt.id, this.getNextHighestDepth(), {_x:mask._x, _y:mask._y});
                        rmask = mask.duplicateMovieClip("_rmask"+cArt.id, this.getNextHighestDepth(), {_x:mask._x, _y:mask._y});
                        cArt.setMask(tmask);
                        rArt.setMask(rmask);
                        rArt._visible = cArt._visible=false;
              myMO.onMouseWheel = function(delta:Number):Void  {
                        if (delta>0) {
                                  next();
                        } else if (delta<=0) {
                                  previous();
              myKO.onKeyDown = function():Void  {
                        if (Selection.getFocus() != "_level0.goto") {
                                  if (Key.isDown(Key.RIGHT)) {
                                            next();
                                  } else if (Key.isDown(Key.LEFT)) {
                                            previous();
              scrollBar.scroller.onPress = function():Void  {
                        dist = this._parent._xmouse-this._x;
                        this.onMouseMove = function():Void  {
                                  tmp = 1+Math.ceil(((this._parent._xmouse-dist)-scrollBarStart)/(scrollBar._width-scrollBarStop)*(infostruc.length-1));
                                  if (tmp>infostruc.length) {
                                            tmp = infostruc.length;
                                  if (tmp<1) {
                                            tmp = 1;
                                  current = tmp;
                                  updateInfo();
              scrollBar.scroller.onRelease = scrollBar.scroller.onReleaseOutside=function ():Void {
                        stopDrag();
                        delete this.onMouseMove;
              scrollBar.left.onPress = function():Void  {
                        previous();
                        shifter = setInterval(previous, scrollerDelay);
              scrollBar.right.onPress = function():Void  {
                        next();
                        shifter = setInterval(next, scrollerDelay);
              scrollBar.onMouseUp = function():Void  {
                        clearInterval(shifter);
              scrollBar.onMouseDown = function():Void  {
                        if (this.hitTest(_xmouse, _ymouse, true) && !this.left.hitTest(_xmouse, _ymouse, true) && !this.right.hitTest(_xmouse, _ymouse, true)) {
                                  if (this._xmouse<this.scroller._x) {
                                            previous();
                                            shifter = setInterval(previous, clickDelay);
                                  if (this._xmouse>this.scroller._x+this.scroller._width) {
                                            next();
                                            shifter = setInterval(next, clickDelay);
              goto.restrict = "0-9";
              goto.onKillFocus = function():Void  {
                        if (!isNaN(Number(this.text)+1)) {
                                  if (this.text>infostruc.length) {
                                            this.text = infostruc.length;
                                  if (this.text<1) {
                                            this.text = 1;
                                  current = Number(this.text);
                        } else {
                                  this.text = current;
                        updateInfo();
              fscreen.onPress = function():Void  {
                        fscommand("fullscreen", !(this._currentframe-1));
                        this.gotoAndStop(!(this._currentframe-1)+1);
              slideShow.onPress = function():Void  {
                        if (this._currentframe == 1) {
                                  sliderShow = setInterval(function ():Void {
                                            if (current<infostruc.length) {
                                                      next();
                                            } else if (slideshowLooping) {
                                                      current = 0;
                                                      next();
                                  }, slideshowSpeed);
                        } else {
                                  clearInterval(sliderShow);
                        this.gotoAndStop(!(this._currentframe-1)+1);
              distance = Number(i);
              mask.removeMovieClip();
              fscreen.swapDepths(1102);
              slideShow.swapDepths(1103);
              scrollBar.swapDepths(1101);
              i2.swapDepths(1105);
              i1.swapDepths(1106);
              loader.removeMovieClip();
              loadNext();
              updateInfo();
    function concat(m1, m2):Object {
              var mat:Object = {};
              mat.a = m1.c*m2.b;
              mat.b = m1.d*m2.b;
              mat.c = m1.a*m2.c;
              mat.d = m1.b*m2.c;
              mat.tx = m1.a*m2.tx+m1.c*m2.ty+m1.tx;
              mat.ty = m1.b*m2.tx+m1.d*m2.ty+m1.ty;
              return mat;
    function updateInfo():Void {
              goto.text = current;
              info = infostruc[current-1].info;
              author = infostruc[current-1].auth;
              album = infostruc[current-1].album;
              displayAlternArt(root["_bmd"+(current-1)], artDisplay._width, artDisplay._height);
              scrollBar.scroller._x = scrollBarStart+((current-1)/(infostruc.length-1)*(scrollBar._width-scrollBarStop));
    function brightness(_prop:String, _old:Number, _new:Number, target:MovieClip):Void {
              var brightness_array:Array = [1, 0, 0, 0, _new, 0, 1, 0, 0, _new, 0, 0, 1, 0, _new, 0, 0, 0, 1, 0];
              target.filterArray[1] = new ColorMatrixFilter(brightness_array);
              target.filters = target.filterArray;
    function controlTheObject(mc):Void {
              if (mc._name.indexOf("reflection") == -1) {
                        mc.onPress = function():Void  {
                                  if ((getTimer()-this.pressTime<=doubleClickRegister && this.pressTime) || !doubleClickURL) {
                                            if (infostruc[this.cid].urlToGet) {
                                                      getURL(infostruc[this.cid].urlToGet, "_"+infostruc[this.cid].urlAction);
                                  this.pressTime = getTimer();
                                  current = this.cid+1;
                                  updateInfo();
              mc.watch("_brightness", brightness, mc);
              mc.onEnterFrame = function():Void  {
                        this._visible = true;
                        if (infostruc[this.cid].loaded && !this.loadedImage) {
                                  this.allowUpdate = true;
                                  this.DistortImage(this._name.indexOf("reflection")>-1 ? this._parent["_ref"+this.cid] : this._parent["_bmd"+this.cid]);
                                  this.setTransform(this.px1, this.py1, this.px2, this.py2, this.px3, this.py3, this.px4, this.py4);
                                  this.loadedImage = true;
                        if (Math.round(Math.abs(this._x-this.x))>=1 || this.allowUpdate) {
                                  if (this._name.indexOf("reflection") == -1) {
                                            this._y = centerY+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2));
                                            if (this._x>=centerX+centerDistance) {
                                                      this.swapDepths(-this._x);
                                                      this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), this._parent["_shelveCDWidth"+this.cid]/2, -(this._parent["_shelveCDHeight"+this.cid]/2), this._parent["_shelveCDWidth"+this.cid]/2, this._parent["_shelveCDHeight"+this.cid]/2, -(this._parent["_shelveCDWidth"+this.cid]/2), (this._parent["_shelveCDHeight"+this.cid]/2)-((Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                            } else if (this._x<=centerX-centerDistance) {
                                                      this.swapDepths(this._x);
                                                      this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2), this._parent["_shelveCDWidth"+this.cid]/2, -(this._parent["_shelveCDHeight"+this.cid]/2)+(Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid]), this._parent["_shelveCDWidth"+this.cid]/2, (this._parent["_shelveCDHeight"+this.cid]/2)-(Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid]), -(this._parent["_shelveCDWidth"+this.cid]/2), this._parent["_shelveCDHeight"+this.cid]/2);
                                            } else if (this.cid == current-1 || this.cid == current || this.cid == current-2) {
                                                      if (this._x>centerX-centerDistance && Math.floor(this._x)<centerX && angle-((this._x-(centerX-centerDistance))/centerDistance*angle)>autoJump) {
                                                                this.swapDepths(1002);
                                                                var sum:Number = this._parent["_shelveCDWidth"+this.cid]+((this._x-(centerX-centerDistance))/centerDistance*(this._parent["_frontCDWidth"+this.cid]-this._parent["_shelveCDWidth"+this.cid]));
                                                                var sum2:Number = angle-((this._x-(centerX-centerDistance))/centerDistance*angle);
                                                                var sum3:Number = this._parent["_shelveCDHeight"+this.cid]+((this._x-(centerX-centerDistance))/centerDistance*(this._parent["_frontCDHeight"+this.cid]-this._parent["_shelveCDHeight"+this.cid]));
                                                                this.setSides(-(sum/2), -(sum3/2), sum/2, -(sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), sum/2, (sum3/2)-((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), -(sum/2), sum3/2);
                                                      } else if (this._x<centerX+centerDistance && Math.ceil(this._x)>centerX && angle-(((centerX+centerDistance)-this._x)/centerDistance*angle)>autoJump) {
                                                                this.swapDepths(1003);
                                                                var sum:Number = this._parent["_shelveCDWidth"+this.cid]+(((centerX+centerDistance)-this._x)/centerDistance*(this._parent["_frontCDWidth"+this.cid]-this._parent["_shelveCDWidth"+this.cid]));
                                                                var sum2:Number = angle-(((centerX+centerDistance)-this._x)/centerDistance*angle);
                                                                var sum3:Number = this._parent["_shelveCDHeight"+this.cid]+(((centerX+centerDistance)-this._x)/centerDistance*(this._parent["_frontCDHeight"+this.cid]-this._parent["_shelveCDHeight"+this.cid]));
                                                                this.setSides(-(sum/2), -(sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), sum/2, -(sum3/2), sum/2, sum3/2, -(sum/2), (sum3/2)-((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                                      } else {
                                                                this.swapDepths(1004);
                                                                this.setSides(-(this._parent["_frontCDWidth"+this.cid]/2), -(this._parent["_frontCDHeight"+this.cid]/2), this._parent["_frontCDWidth"+this.cid]/2, -(this._parent["_frontCDHeight"+this.cid]/2), this._parent["_frontCDWidth"+this.cid]/2, this._parent["_frontCDHeight"+this.cid]/2, -(this._parent["_frontCDWidth"+this.cid]/2), this._parent["_frontCDHeight"+this.cid]/2);
                                            } else {
                                                      if (this._x>centerX-centerDistance && Math.floor(this._x)<centerX && angle-((this._x-(centerX-centerDistance))/centerDistance*angle)>autoJump) {
                                                                this.swapDepths(1002);
                                                                var sum2:Number = angle-((this._x-(centerX-centerDistance))/centerDistance*angle);
                                                                this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2), this._parent["_shelveCDWidth"+this.cid]/2, -(this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), this._parent["_shelveCDWidth"+this.cid]/2, (this._parent["_shelveCDHeight"+this.cid]/2)-((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), -(this._parent["_shelveCDWidth"+this.cid]/2), this._parent["_shelveCDHeight"+this.cid]/2);
                                                      } else if (this._x<centerX+centerDistance && Math.ceil(this._x)>centerX && angle-(((centerX+centerDistance)-this._x)/centerDistance*angle)>autoJump) {
                                                                this.swapDepths(1003);
                                                                var sum2:Number = angle-(((centerX+centerDistance)-this._x)/centerDistance*angle);
                                                                this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), this._parent["_shelveCDWidth"+this.cid]/2, -(this._parent["_shelveCDHeight"+this.cid]/2), this._parent["_shelveCDWidth"+this.cid]/2, this._parent["_shelveCDHeight"+this.cid]/2, -(this._parent["_shelveCDWidth"+this.cid]/2), (this._parent["_shelveCDHeight"+this.cid]/2)-((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                  } else {
                                            this._yscale = -100;
                                            this._y = centerY+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2))+this._parent["_shelveCDHeight"+this.cid]+reflectionSpace;
                                            if (this._x>=centerX+centerDistance) {
                                                      this.swapDepths(-this._x-333);
                                                      this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2)+(Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid]), -(this._parent["_shelveCDWidth"+this.cid]/2)+this._parent["_shelveCDWidth"+this.cid], -(this._parent["_shelveCDHeight"+this.cid]/2), -(this._parent["_shelveCDWidth"+this.cid]/2)+this._parent["_shelveCDWidth"+this.cid], this._parent["_shelveCDHeight"+this.cid]/2, -(this._parent["_shelveCDWidth"+this.cid]/2), (this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                            } else if (this._x<=centerX-centerDistance) {
                                                      this.swapDepths(this._x-333);
                                                      this.setSides(-(this._parent["_shelveCDWidth"+this.cid]/2), -(this._parent["_shelveCDHeight"+this.cid]/2), -(this._parent["_shelveCDWidth"+this.cid]/2)+this._parent["_shelveCDWidth"+this.cid], -(this._parent["_shelveCDHeight"+this.cid]/2)+((Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), -(this._parent["_shelveCDWidth"+this.cid]/2)+this._parent["_shelveCDWidth"+this.cid], (this._parent["_shelveCDHeight"+this.cid]/2)+(Math.sin(angle*Math.PI/180)*this._parent["_frontCDWidth"+this.cid]), -(this._parent["_shelveCDWidth"+this.cid]/2), this._parent["_shelveCDHeight"+this.cid]/2);
                                            } else if (this.cid == current-1 || this.cid == current || this.cid == current-2) {
                                                      if (this._x>centerX-centerDistance && this._x<centerX && !validateOk(this)) {
                                                                this.swapDepths(999);
                                                                var sum:Number = this._parent["_shelveCDWidth"+this.cid]+((this._x-(centerX-centerDistance))/centerDistance*(this._parent["_frontCDWidth"+this.cid]-this._parent["_shelveCDWidth"+this.cid]));
                                                                var sum2:Number = angle-((this._x-(centerX-centerDistance))/centerDistance*angle);
                                                                var sum3:Number = this._parent["_shelveCDHeight"+this.cid]+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2))+((this._x-(centerX-centerDistance))/centerDistance*(this._parent["_frontCDHeight"+this.cid]-this._parent["_shelveCDHeight"+this.cid]));
                                                                this._y = centerY+sum3+reflectionSpace;
                                                                this.setSides(-(sum/2), -(sum3/2), sum/2, -(sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), sum/2, (sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), -(sum/2), sum3/2);
                                                      } else if (this._x<centerX+centerDistance && this._x>centerX && !validateOk(this)) {
                                                                this.swapDepths(998);
                                                                var sum:Number = this._parent["_shelveCDWidth"+this.cid]+(((centerX+centerDistance)-this._x)/centerDistance*(this._parent["_frontCDWidth"+this.cid]-this._parent["_shelveCDWidth"+this.cid]));
                                                                var sum2:Number = angle-(((centerX+centerDistance)-this._x)/centerDistance*angle);
                                                                var sum3:Number = this._parent["_shelveCDHeight"+this.cid]+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2))+(((centerX+centerDistance)-this._x)/centerDistance*(this._parent["_frontCDHeight"+this.cid]-this._parent["_shelveCDHeight"+this.cid]));
                                                                this.setSides(-(sum/2), -(sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])), sum/2, -(sum3/2), sum/2, sum3/2, -(sum/2), (sum3/2)+((Math.sin(sum2*Math.PI/180)*this._parent["_frontCDWidth"+this.cid])));
                                                                this._y = centerY+sum3+reflectionSpace;
                                                      } else if (!validateOk(this)) {
                                                                this.swapDepths(995);
                                                                this._y = centerY+((shelveCDHeight/2)-(this._parent["_shelveCDHeight"+this.cid]/2))+this._parent["_frontCDHeight"+this.cid]+reflectionSpace;
                                                                this.setSides(-(this._parent["_frontCDWidth"+this.cid]/2), -(this._parent["_frontCDHeight"+this.cid]/2), this._parent["_frontCDWidth"+this.cid]/2, -(this._parent["_frontCDHeight"+this.cid]/2), this._parent["_frontCDWidth"+this.cid]/2, this._parent["_frontCDHeight"+this.cid]/2, -(this._parent["_frontCDWidth"+this.cid]/2), this._parent["_frontCDHeight"+this.cid]/2);
                                  this.allowUpdate = false;
                                  this._x -= Math.min(Math.max((this._x-this.x)/albumEase, -maxSlide), maxSlide);
                                  this.setTransform(this.px1, this.py1, this.px2, this.py2, this.px3, this.py3, this.px4, this.py4);
                                  if (this._x<deleteMinDistance && this._parent["_ref"+(this.cid+distance)]) {
                                            this.cid += distance;
                                            this._x = deleteMaxDistance;
                                            controlTheObject(this);
                                            this._visible = false;
                                            this.loadedImage = infostruc[this.cid].loaded;
                                            this.DistortImage(this._name.indexOf("reflection")>-1 ? this._parent["_ref"+this.cid] : this._parent["_bmd"+this.cid]);
                                  if (this._x>deleteMaxDistance && this._parent["_ref"+(this.cid-distance)]) {
                                            this.cid -= distance;
                                            this._x = deleteMinDistance;
                                            controlTheObject(this);
                                            this._visible = false;
                                            this.loadedImage = infostruc[this.cid].loaded;
                                            this.DistortImage(this._name.indexOf("reflection")>-1 ? this._parent["_ref"+this.cid] : this._parent["_bmd"+this.cid]);
                        } else if (Math.ceil(Math.abs(this._x-this.x)) == 0) {
                                  this._x = this.x;
                        if (this.cid+1>current) {
                                  this.x = (centerX+((this.cid+1-current)*shelveCDSpacing))+centerDistance;
                        } else if (this.cid+1<current) {
                                  this.x = (centerX+((this.cid+1-current)*shelveCDSpacing))-centerDistance;
                        } else {
                                  this.x = centerX+((this.cid+1-current)*shelveCDSpacing);
                        if (fadeType == "brightness") {
                                  if (this._x<fadePointMin+fadeDist) {
                                            this._brightness = -(250-((this._x-fadePointMin)/fadeDist*250));
                                  } else if (this._x>fadePointMax-fadeDist) {
                                            this._brightness = -(250-((fadePointMax-this._x)/fadeDist*250));
                                  } else {
                                            this._brightness = 0;
                        } else if (fadeType == "alpha") {
                                  if (this._x<fadePointMin+fadeDist) {
                                            this._alpha = ((this._x-fadePointMin)/fadeDist*100);
                                  } else if (this._x>fadePointMax-fadeDist) {
                                            this._alpha = ((fadePointMax-this._x)/fadeDist*100);
                                  } else {
                                            this._alpha = 100;
    function next():Void {
              if (current<infostruc.length) {
                        current += 1;
              updateInfo();
    function previous():Void {
              if (current>1) {
                        current -= 1;
              updateInfo();
    function displayAlternArt(art, width:Number, height:Number):Void {
              artDisplay.attachBitmap(art, 1);
              artDisplay._width = width;
              artDisplay._height = height;
    function loadNext():Void {
              if (!loadedAll) {
                        var num:Number = current-1;
                        if (infostruc[current-1].loaded) {
                                  var num:Number = current-Math.floor(distance/2)-1>=0 ? current-Math.floor(distance/2)-1 : 0;
                                  while (infostruc[num].loaded && num<infostruc.length) {
                                            num++;
                                  if (num>=infostruc.length) {
                                            var num:Number = current-1;
                                            while (infostruc[num].loaded && num>0) {
                                                      num--;
                                            if (num<=0) {
                                                      loadedAll = true;
                        var newLoad:MovieClip = this.createEmptyMovieClip("artLoad"+num, this.getNextHighestDepth());
                        newLoad.createEmptyMovieClip("art", newLoad.getNextHighestDepth());
                        newLoad._alpha = 0;
                        var mc:Object = {};
                        mc.number = num;
                        var artLoader:MovieClipLoader = new MovieClipLoader();
                        artLoader.addListener(mc);
                        artLoader.loadClip(infostruc[num].httpType+infostruc[num].art, newLoad.art);
                        mc.onLoadError = function() {
                                  infostruc[this.number].loaded = true;
                                  loadNext();
                        mc.onLoadInit = function(target:MovieClip) {
                                  tw = target._width;
                                  ty = target._height;
                                  if (_CDProportions == "auto") {
                                            if (target._width>target._height) {
                                                      target._width = Math.min(frontCDWidth, target._width);
                                                      target._yscale = target._xscale;
                                            } else {
                                                      target._height = Math.min(frontCDHeight, target._height);
                                                      target._xscale = target._yscale;
                                  root["_frontCDWidth"+this.number] = Math.min(frontCDWidth, target._width);
                                  root["_frontCDHeight"+this.number] = Math.min(frontCDHeight, target._height);
                                  target._width = tw;
                                  target._height = ty;
                                  root["_bmd"+this.number] = new BitmapData(target._width, target._height);
                                  root["_ref"+this.number] = new BitmapData(target._width, target._height);
                                  root["_bmd"+this.number].draw(target);
                                  var mc:MovieClip = target._parent.createEmptyMovieClip("gradient_mc", target._parent.getNextHighestDepth());
                                  matrix = new Matrix();
                                  matrix.createGradientBox(target._width, target._height, reflectionRotation/180*Math.PI, 0, 0);
                                  mc.beginGradientFill(reflectionFillType, reflectionColors, reflectionAlphas, reflectionRatios, matrix, reflectionSpreadMethod, reflectionInterpolationMethod, reflectionFocalPointRatio);
                                  mc.moveTo(0, 0);
                                  mc.lineTo(0, target._height);
                                  mc.lineTo(target._width, target._height);
                                  mc.lineTo(target._width, 0);
                                  mc.lineTo(0, 0);
                                  mc.endFill();
                                  target._parent.beginFill(reflectionBackgroundColour);
                                  target._parent.moveTo(0, 0);
                                  target._parent.lineTo(0, target._height);
                                  target._parent.lineTo(target._width, target._height);
                                  target._parent.lineTo(target._width, 0);
                                  target._parent.lineTo(0, 0);
                                  target._parent.endFill();
                                  target._alpha = reflectionAlpha;
                                  root["_ref"+this.number].draw(target._parent);
                                  infostruc[this.number].loaded = true;
                                  if (_CDProportions == "auto") {
                                            if (target._width>target._height) {
                                                      target._width = Math.min(shelveCDWidth, target._width);
                                                      target._yscale = target._xscale;
                                            } else {
                                                      target._height = Math.min(shelveCDHeight, target._height);
                                                      target._xscale = target._yscale;
                                  root["_shelveCDWidth"+this.number] = Math.min(shelveCDWidth, target._width);
                                  root["_shelveCDHeight"+this.number] = Math.min(shelveCDHeight, target._height);
                                  target._parent.removeMovieClip();
                                  updateInfo();
                                  loadNext();
    xmlData.onLoad = function(success:Boolean):Void  {
              if (success) {
                        for (var i:Number = -1; this.childNodes[0].childNodes[++i]; ) {
                                  var cNode:XMLNode = this.childNodes[0].childNodes[i].childNodes;
                                  var val1:String = cNode[1].childNodes[0].nodeValue ? unescape(cNode[1].childNodes[0].nodeValue) : unknownSong;
                                  var val2:String = cNode[2].childNodes[0].nodeValue ? unescape(cNode[2].childNodes[0].nodeValue) : unknownArtist;
                                  var val3:String = cNode[3].childNodes[0].nodeValue ? unescape(cNode[3].childNodes[0].nodeValue) : unknownAlbum;
                                  var val4:String = cNode[4].childNodes[0].nodeValue ? unescape(cNode[4].childNodes[0].nodeValue) : "./";
                                  var val5:String = cNode[5].childNodes[0].nodeValue ? unescape(cNode[5].childNodes[0].nodeValue) : undefined;
                                  var val6:String = cNode[6].childNodes[0].nodeValue ? unescape(cNode[6].childNodes[0].nodeValue) : undefined;
                                  infostruc.push({art:cNode[0].childNodes[0].nodeValue, info:val1, auth:val2, album:val3, httpType:val4, urlToGet:val5, urlAction:val6, loaded:false});
                                  root["_frontCDWidth"+i] = frontCDWidth;
                                  root["_frontCDHeight"+i] = frontCDHeight;
                                  root["_shelveCDWidth"+i] = shelveCDWidth;
                                  root["_shelveCDHeight"+i] = shelveCDHeight;
                        init();
                        loadStat = "";
              } else {
                        loadStat = "There was an error loading that data, sorry.";
    xmlData.ignoreWhite = true;
    loadPlayList("./albuminfo9.xml");
    loader._visible = false;
    mask._alpha = 0;
    scrollBar.scroller._y = 0;

    This won't work on most servers: "./albuminfo9.xml". It should be "../albuminfo9.xml". That may or may not solve the problem. Be sure that all of your files and folders are in the same relative location on the server as they are on your computer. Also be sure that the case for each referenced item is correct. Upper and lower case are sometimes more important on a server than they are on your computer. JPG is not the same as jpg. Be sure that your files are uploading correctly.

  • Uploaded image files not displayed correctly

    Hello everyone,
    I used the following article(on o'reilly) as reference for file upload:
    http://www.onjava.com/pub/a/onjava/2001/04/05/upload.html?page=1
    While it works fine for most files types, there are problems with image files.(I am using PrintStream, BufferedOutputStream,FileOutputStream to write the files on the server).
    When links to these image files are clicked, the uploaded gif and jpeg image files are not displayed correctly.When directly opening the files on the server, it gives a 'error opening file' message.But other word docs , text files do not give an error.
    If anyone else has come across the same problem and could help out , I would appreciate it.
    Thanks in advance.

    I do not want to enter into the logic which you are following to upload the file. I did the upload process successfully even as a blob datatype.
    For this I followed the logic given in http://www.java.isavvix.com/codeexchange/codeexchange-viewdetail.jsp?id=22.
    Here you can download the complete sourse code, which is working fine for gif and jpeg, I tested.
    Please go with this. Also let me know, if you still have problem.
    Regards.

  • Upload Image Files into IFS

    Dear Members,
    I am trying to upload files from my local disk to the IFS. There is no problem about uploading txt files. But i could not upload the image files like ".tif".
    Is there anyone who can help me urgently please?
    Here is the part of my source code..
    DocumentDefinition newDocDef = new DocumentDefinition(ifsSession);
    newDocDef.setName(filename);
    newDocDef.setContentPath(localpath);
    newDocDef.setAddToFolderOption(runtime);
    Document doc = (Document)ifsSession.createPublicObject(newDocDef);

    Dear Sir,
    This topic is very urgent for me, and I will be very happy for your help.
    I have changed my code like this.
    ClassObject co = classUtils.lookupClassObject("DOCUMENT");
    Collection c = ifsSession.getFormatExtensionCollection();
    Format f = (Format) c.getItems("tif");
    DocumentDefinition newDocDef = new DocumentDefinition(ifsSession);
    newDocDef.setContentPath(localpath);
    newDocDef.setAddToFolderOption(runtime);
    newDocDef.setName(filename);
    newDocDef.setClassObject(co);
    newDocDef.setFormat(f);
    TieDocument doc = (TieDocument)ifsSession.createPublicObject(newDocDef);
    And the error message is here.
    oracle.ifs.common.IfsException:
    IFS-30002: Unable to create new LibraryObject oracle.ifs.common.IfsException:
    IFS-32225: Error storing reference to content object 22,432 in media InterMediaBlob java.sql.SQLException:
    ORA-00911: invalid character
         void oracle.jdbc.dbaccess.DBError.throwSqlException(java.lang.String, java.lang.String, int)           DBError.java:187      void oracle.jdbc.ttc7.TTIoer.processError()           TTIoer.java:241      void oracle.jdbc.ttc7.Oall7.receive()           Oall7.java:543      void oracle.jdbc.ttc7.TTC7Protocol.doOall7(byte, byte, int, byte[], oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int, oracle.jdbc.dbaccess.DBType[], oracle.jdbc.dbaccess.DBData[], int)           TTC7Protocol.java:1477      int oracle.jdbc.ttc7.TTC7Protocol.parseExecuteFetch(oracle.jdbc.dbaccess.DBStatement, byte, byte[], oracle.jdbc.dbaccess.DBDataSet, int, oracle.jdbc.dbaccess.DBDataSet, int)           TTC7Protocol.java:888      void oracle.jdbc.driver.OracleStatement.executeNonQuery(boolean)           OracleStatement.java:2004      void oracle.jdbc.driver.OracleStatement.doExecuteOther(boolean)           OracleStatement.java:1924      void oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout()           OracleStatement.java:2562      int oracle.jdbc.driver.OraclePreparedStatement.executeUpdate()           OraclePreparedStatement.java:452      boolean oracle.jdbc.driver.OraclePreparedStatement.execute()           OraclePreparedStatement.java:526      boolean oracle.ifs.server.S_LibrarySession.execute(java.sql.PreparedStatement)           S_LibrarySession.java:14518      oracle.sql.BLOB oracle.ifs.server.S_MediaBlob.createBlobReference(java.lang.Long, java.lang.String)           S_MediaBlob.java:398      java.io.OutputStream oracle.ifs.server.S_MediaBlob.getOutputStream(java.lang.Long, java.lang.String)           S_MediaBlob.java:240      java.io.OutputStream oracle.ifs.server.S_MediaBlob.getOutputStream(java.lang.Long)           S_MediaBlob.java:225      java.lang.Long oracle.ifs.server.S_Media.setContentStream(java.io.InputStream)           S_Media.java:1741      void oracle.ifs.server.S_Media.setContent(oracle.ifs.server.S_LibraryObjectDefinition)           S_Media.java:1680      void oracle.ifs.server.S_ContentObject.setContent(oracle.ifs.server.S_LibraryObjectDefinition)           S_ContentObject.java:402      void oracle.ifs.server.S_ContentObject.extendedPreInsert(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_ContentObject.java:239      void oracle.ifs.server.S_LibraryObject.preInsert(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibraryObject.java:1644      oracle.ifs.server.S_LibraryObjectData oracle.ifs.server.S_LibraryObject.createInstance(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibraryObject.java:2711      oracle.ifs.common.AttributeValue oracle.ifs.server.S_LibrarySession.createSystemObjectInstance(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:8365      void oracle.ifs.server.S_Document.setContentObject(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition, oracle.ifs.server.S_ContentQuota, boolean)           S_Document.java:475      void oracle.ifs.server.S_Document.extendedPreInsert(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_Document.java:313      void oracle.ifs.server.S_LibraryObject.preInsert(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibraryObject.java:1644      oracle.ifs.server.S_LibraryObjectData oracle.ifs.server.S_LibraryObject.createInstance(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibraryObject.java:2711      oracle.ifs.server.S_LibraryObject oracle.ifs.server.S_LibrarySession.newLibraryObject(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:8159      oracle.ifs.server.S_PublicObject oracle.ifs.server.S_LibrarySession.newPublicObject(oracle.ifs.server.OperationState, oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:8200      oracle.ifs.server.S_PublicObject oracle.ifs.server.S_LibrarySession.newPublicObject(oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:8182      oracle.ifs.server.S_LibraryObjectData oracle.ifs.server.S_LibrarySession.DMNewPublicObject(oracle.ifs.server.S_LibraryObjectDefinition)           S_LibrarySession.java:7841      oracle.ifs.server.S_LibraryObjectData oracle.ifs.beans.LibrarySession.DMNewPublicObject(oracle.ifs.server.S_LibraryObjectDefinition)           LibrarySession.java:8015      oracle.ifs.beans.PublicObject oracle.ifs.beans.LibrarySession.NewPublicObject(oracle.ifs.beans.PublicObjectDefinition)           LibrarySession.java:5373      oracle.ifs.beans.PublicObject oracle.ifs.beans.LibrarySession.createPublicObject(oracle.ifs.beans.PublicObjectDefinition)           LibrarySession.java:2985 Process exited with exit code 0.

Maybe you are looking for