Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Uploading files in JSP

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey all,

I've successfully uploaded files, using jsp, on my local web server. I cannot, however, do so to my 3rd-party hosting site (godaddy.com) because I have a java.io.FilePermission problem.

I'm guessing that the fileOut.write class method, when trying to write a file to the server, isn't locating the proper directory where uploads are accetable. Problem is: I don't know how to direct it to the directory. When I upload it to my local web server, it saves it to c:\windows\system32 which is very weird.

Any ideas on how I can find out which directory "fileOut.write" writes to? Am I correct is thinking "fileOut" is the correct class to use?
 
William Fretts-Saxton
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fileOut declaration:

FileOutputStream fileOut = new FileOutputStream(<file>);
[ March 09, 2005: Message edited by: William Fretts-Saxton ]
 
William Fretts-Saxton
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still no luck.

I tried using a File("") and the "getAbsolutePath()" method, which returned "/root".

I then used File("/root") and the "list()" method to return all files and directories in "/root" but I got permission denied.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why not use an absolute path to the directory?
It may also be that your hosting company has wisely set a security policy prohibiting disk writes from within a webapp.

You might want to check with them to see if this is even allowed.
 
William Fretts-Saxton
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't even know what the absolute path. How can I tell where the "php_uploads" directory is, in absolute terms?

If you mean just "/root", I tried that and got permission denied.

FYI,The permissions on the php_uploads directory is 770. Everything else that is created is 755 so it seems to me that this would be the place they would allow uploads. I just don't know how to allow the outside world to upload stuff as the owner or the group.
 
Bras cause cancer. And tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic