How to upload Images to online web server using VB.NET using desktop application - vb.net

I am developing a desktop application (network-aware) that work with network to collect and store the users' personal information, including passports and signatures of the users.
I initially store the images in database by converting them to bytes and store them in longblub data-type. Later after realizing that my database is getting to heavy decided to convert all the images back to normal .jpg file and upload them to web server.
Now as all the images are manually uploaded, i want make sure all the images of new users will be uploaded when save-button is click on the desktop application
Thank you.

If you have the permission to create a shared folder on webserver \\servername\sharefolder$.
Use File Open Dialog Control, after button click, you can direct save file into the shared folder
string fulllocimage = openFileDialog1.FileName;
File.Copy(fulllocimage, Path.Combine(#"\\servername\sharefolder$",Path.GetFileName(fulllocimage));

Related

Server data transfer from static folder to client

I have a server with a static folder that contains some images for the public to preview.
I use Nodejs Express to serve the static folder.
I have 1TB data transfer each month.
Let's say an image is 1MB in size.
So, if a user used an image's link to view it does my server upload the image to the user? and 1MB is consumed from the 1TB?
Or the user who has to download it?
For example, opening google images and a bunch of images is loaded on your screen, does google upload all these images?
I need some explanations, thank you in advance :)

Save to drive vs File Picker

My main objective is to upload files to drive from my device ( a web application in JS) and read files from Drive. Exploring for the same scenario , i was confused with two API-SaveToWeb and FilePicker , from Google drive , which actually provides the same functionality (upload files to drive ) .
Help me to understand which one is used in which scenario ?
In some scenarios you could use either, but it depends a bit on your use case and the UX you want.
The save to drive button is useful when you know the specific file that the user will want to save. Its a very simple UX where you just put the button next to the specific file(s).
The file picker is used when you want the user to select the file that they will update. Its a little more involved, but gives the users more control over what they select.

Backup Isolated Storage as whole and recover

I am developing a Windows Phone 7.1 application. The app serializes objects to JSON and saves them to the IsolatedStorageSettings file.
The objects also have images that the user may capture with a camera. These images are saved to Isolated Storage as a jpeg file with the "Extensions.SaveJpeg" method. Images are referenced by a unique ID from the object JSON so they can be loaded from the storage with the object itself or loaded only when needed.
Now that I have this up and running, I would like to create a backup to SkyDrive functionality with recovery.
What I want to ask is how can I simply backup the Isolated Storage as whole, and recover as whole?
I've been thinking if there is a way to (1) generate a zip file containing the whole Isolated Storage, (2) upload that to SkyDrive, (3) downloading from SkyDrive and (4) unzipping it replacing any existing files in the storage.
The steps (2) and (3) I know how to do (instructions found easily by google). I can also do step (1) but with many lines of code. I am seeking for a simple solution to zip the whole storage and recover from it.
I recommend you to use Perst as the local database solution for your windows phone application.It can be imported or exported as xml which you can upload/download to/from SkyDrive or other cloud system.
Home page of Perst:http://www.mcobject.com/perst/

File permissions on a web server?

I'm new at writing code for websites. The website allows users to upload files, such as profile pictures or other pictures. The files are saved in the unix file system and the URLs to find those images are stored in a MySQL database.
It seems like the only way I can let the user upload files is to give write access to anybody using chmod. Otherwise it complains that it doesn't have write permissions. But they shouldn't be able to write whatever they want or overwrite other users stuff. Similarly, to allow users to see images that they have rightful access to, they need read permissions on the file system. But now that means that anybody with the url to that picture can see the image too, correct? That's not what I want.
Is there a solution to this contradiction? Or am I thinking about the problem incorrectly? Thanks for any help.
You need to manage the permissions in your application and not expose arbitrary parts of your local filesystem directly to the clients. Your application should decide what files someone can see or where to write data. You should not trust data (filenames, etc) from your clients...ideally, store files on disk using systematically generated names and store human-readable names in the database.
SunStar9,
Since you are already using a MySQL database to store the URL of the image on the file system, why not just store the image itself as a BLOB (binary large object)?
This is generally a well-accepted design practice for allowing users to upload binary data to a website.
Are you using PHP, Java, Ruby/Rails, or something other to develop your website? Depending on what you are using, there could be file upload/management plugins or modules that will help you develop what you are trying to do if you are certain you want to use the files ystem for storing the image data.

How to Load binary to Windows Media Player in Windows Forms VB.NET

I've successfully saved video files into SQL server as varbinary. Now, my problem is, how can I play those videos in Windows Media Player (embedded in my Windows Forms).
I've searched the internet but got no luck. Any idea?
Thanks in advance!
Read from the database and write it to a temp file when a video is to be viewed. Then you can set the URL property to the temp file's full path like normal. If you don't want the file to remain you can clean up after viewing, otherwise I might keep it to speed up future views. Just in case, here's MSDN on embedding the Windows Media Control with VB.