Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

From an applet, how do I get information, like size and creation time, about a file on the server?

0
Posted

From an applet, how do I get information, like size and creation time, about a file on the server?

0

Location: http://www.jguru.com/faq/view.jsp?EID=75649 Created: Jun 14, 2000 Modified: 2001-08-18 17:30:02.807 Author: Brian O’Byrne (http://www.jguru.com/guru/viewbio.jsp?EID=38567) Question originally posed by Steven Li (http://www.jguru.com/guru/viewbio.jsp?EID=62131 Assuming you have access to the file in question through a web server, you can use the URLConnection methods getContentLength() and getLastModified(). URL fileOfInterest = new URL(…); URLConnection connectionToFileOfInterest = fileOfInterest.getConnection(); int contentLength = connectionToFileOfInterest.getContentLength(); long lastModifiedTime = connectionToFileOfInterest.getLastModified(); You cannot get the creation time this way. Warning: this is not reliable across Web servers and you may end up downloading the file completely to get the size.

Related Questions

Thanksgiving questions

*Sadly, we had to bring back ads too. Hopefully more targeted.