I'm working on a website and i need to do the functionality for allowing a user to upload the videos. I tried doing it but at run time NetBeans came an error of max length exceeded i tried resolving it by writing max_allowed_packet=100 M in my.ini file in mysql but it did not help as it gave a message of access denied.
Can you please guide me how to get it fixed?
Don't do that. Use the filesystem to store multi-megabyte videos, and use the database to store filenames and paths. A huge video file in a database is also less efficiently served than a video stored directly in a file. Webservers can make use of server calls like sendfile and splice to serve large files efficiently, but the database adds several copies and delays.
That being said, you need to set max_allowed_packet on both the client and server sides.
Related
I have a java application running on Apache tomcat on two different servers A and B. The application involves uploading and downloading files mostly pdf and images. Currently I have an FTP server F ,where I host all my files. Now I am having the following problems:
Uploading and Downloading of files is causing issues while creating FTP connection (Sometimes it connects and Sometimes it throws the timeout error).
I am displaying images by converting them into BASE 64 format, which causes the same trouble discussed above.
Solutions that I can think of is
Use application server to host files (Is it a right practice??),
also as I have two different servers running the application it
would be tough to create a sync between them.
I have heard something about shared file hosting but that will cause security troubles.
Any solutions for my above problem would be really appreciated.Thanks
If your application uses a database, you could store these files as LOBs (Character or binary large objects)in the database instead of on disk.
If the files are small you can store them as CLOB or BLOB in a database and serve them through HTTP (rest endpoints from your application server)
If your files are large, store them in a NAS or any other shared storage. Don't convert them to BASE64 instead serve them as binary attachments over HTTP (rest endpoints from your application server). You may or may not store the file locations somewhere maybe in Database to keep track of it.
I'm currently developing a Tracking System with JavaFX and MySQL as database that is kept in a server. My application is used within a network and allows users to upload and download pictures and several types of document.
My question: What is the best way to send and retrieve files to a server within a network? And should I store those files in MySQL or just their paths in MySQL? If only files' paths, do I need FTP or other techniques? I need detail answer because it is my first time to develop such application.
Edit: I want to store data in a server. I build this application for client machines so that clients can keep documents in the server and they can access their files from any machines... I have no idea for how to transfer files from client machines to server. Please help me!
You should use socket programming like what is at following link:
http://www.rgagnon.com/javadetails/java-0542.html
.But if you are using Java7, Files is the best one instead of BufferedInputStream or FileInputStream (No extra library require):
/* You can get Path from file also: file.toPath() */
Files.copy(InputStream in, Path target)
Files.copy(Path source, OutputStream out)
I have done a backup and restore application for java phone including nokia, it works fine but pictures larger than 1 MB cannot be uploaded is that possible to upload a file larger than 1 MB, if so please suggest me whether it is possible on HTTP or FTP.
Thank you.
Have a look at this step by step tutorial. What you need is to send files in multiple parts over a persistent HTTP connection.
Uploading files to HTTP server using POST on Android.
I have a GAE application (Java) and I have to populate my datastore from an external file. Using localhost it's working fine. The problem is while deploying it I always get
Error: Server Error
The server encountered an error and could not complete your request.
If the problem persists, please report your problem and mention this
error message and the query that caused it.
This is my path file "war\WEB-INF\test.data"
Question: Is there is any change between local and distant access?
any help?
We need to understand what you are executing to populate the datastore from the local file. Here are some points:
Assuming that you have uploaded the file in WEB-INF folder with name test.data, your file path should be `WEB-INF/test.data'
Are you running the code to load data via some url e.g. http://yorappid.appspot.com/loaddata or something like that? If yes, chances are that your code is taking much longer to process than the 60 seconds hard limit that AppEngine places on completing HTTP Requests. So that could be the problem where you request is not getting complete.
I suggest that if point 2 above is the case, please move your code to a Cron Job. They have a limit of 10 minutes and it might sufficient to load up your data. I am not sure about the amount of data that you plan to load but 10 minutes would be more than enough to load up a sufficiently large amount of data.
Hope this helps.
What would be a scalable file upload/download system/database?
I'm building a website where users can login, upload images that are private, but truly private. I can't upload them to a map on the harddisk of a server, since that would not scale (what happend if we add more servers?) and it wouldn't be private since everyone could go:
http://127.372.171.33/images/private_picture.png
and download the file.
I am building the project in Play Framework (scala/java)
How do websites like flickr handle these kind of things? Do they put them in a database? And what kind of database would be suitable for this situation?
Thanks for help
I can't tell you how those big sites handle it but putting those images into a database might be one way.
Another way would be to put the files into a virtual filesystem that spans a cluster of servers or distribute them onto different servers and just don't make the directories that contain the images visible to the webserver. Thus nobody should be able to open the image just using the server and the path on that server.
To actually deliver the images you could them implement some streaming service that sends a bytestream to the browser for display (like the webservers would do as well). This service could first check the download permissions for the requested image.