I'm trying to upload mp4 files to my app but when I view them in the page the video is missing but the audio is ok.

I appreciate the fact that movie/mp4 files can be incredibly complicated in structure but I wondered if anybody knew a way to do this or if anybody had any success in uploading mp4s.

Here is my code in my upload listener:

                // ** Handle Movies
                log.debug("Handling a mp4");

                // Build filename for movie
                fileName = getMedia().getGuid() + ".mp4";

                // Write the file to the File System
                InputStream stream = uploadedFile.getStream();

                OutputStream bos;
                try {
bos = new FileOutputStream(uploadDir + "/" + fileName);

                    int bytesRead = 0;
                    byte[] buffer = new byte[8192];

while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
                        bos.write(buffer, 0, bytesRead);
                    }

                    bos.close();

                    //close the stream
                    stream.close();

                } catch (IOException e) {
                    e.printStackTrace();
                }

I'm not terribly oufait with file reading & writing, but I'm guessing it has something to do with writing the file back to the filesystem.

Any ideas?

Adam


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to