Google Appengine doesn't provide a file system like traditional environments do, and hence they disabled java.io.File. You'll need to use the Google Cloud Storage API to read and write files.
- Eric On Friday, June 26, 2015 at 5:58:46 AM UTC-4, Syed Mudassir Ahmed wrote: > > However, the file that you are trying to use must be accessible from your > web-application context/environment. > > On Friday, 26 June 2015 15:27:37 UTC+5:30, Syed Mudassir Ahmed wrote: >> >> java.io is one of the core packages. How can your web application not >> support it? This I believe is incorrect statement. By the way, where are >> you using this code? On client-side or server-side? >> >> On Friday, 12 June 2015 10:04:44 UTC+5:30, Nguyen wrote: >>> >>> Based on Google Drive API reference guiding how to insert file >>> https://developers.google.com/drive/v2/reference/files/insert >>> >>> // File's metadata. >>> File body = new File(); >>> body.setTitle(title); >>> body.setDescription(description); >>> body.setMimeType(mimeType); >>> >>> // File's content. >>> java.io.File fileContent = new java.io.File(filename); >>> FileContent mediaContent = new FileContent(mimeType, fileContent); >>> try { >>> File file = service.files().insert(body, mediaContent).execute(); >>> >>> // Uncomment the following line to print the File ID. >>> // System.out.println("File ID: " + file.getId()); >>> >>> return file; >>> } catch (IOException e) { >>> System.out.println("An error occured: " + e); >>> return null; >>> } >>> >>> >>> However, my application is web application & it does not support >>> java.io.File package when uploaded to Google app engine => i can not use >>> this to set content for file object >>> >>> java.io.File fileContent = new java.io.File(filename); >>> FileContent mediaContent = new FileContent(mimeType, fileContent); >>> >>> >>> Is there any other methods to implement this such as using blob or >>> binary data to be file content instead? Tks for advance! >>> >>> Hung Nguyen. >>> >> -- You received this message because you are subscribed to the Google Groups "Google Spreadsheets API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
