Uploading screenshots

duall

Member
Joined
Jun 12, 2007
Messages
13
Programming Experience
Beginner
i need to make a program that will take a screenshot and upload it to my website :confused:
 
Just to correct a bit, the screenshot code is very simple, like this:
VB.NET:
Dim rct As Rectangle = Screen.PrimaryScreen.Bounds
Dim bmp As New Bitmap(rct.Width, rct.Height)
Dim g As Graphics = Graphics.FromImage(bmp)
g.CopyFromScreen(0, 0, 0, 0, rct.Size)
g.Dispose()
bmp.Save("c:\source.png", Imaging.ImageFormat.Png)
bmp.Dispose()
...but Remoting is not used to upload the image to a web server, to do this you use your FTP account, for example like this:
VB.NET:
My.Computer.Network.UploadFile("c:\source.png", "ftp://yoursite.com/target.png", "username", "password")
 
well thanks for all your help but i dont want to write FTP username & password into my application for security reasons, is there any other way to send image to my http website ? (well i can send text files easily throw POST command, i wonder if I can send images as text if so how ?)
 
All the posting options are discussed in this thread: http://www.vbdotnetforums.com/showthread.php?t=18311

Other than that you have all the "server" options, using any kind of server application written by you or others that will accept the connection, receive the file and store it in the file system, this also includes setting up a Remoting or Webservice application on the webserver.

About passwords and security, you have all kinds of options to handle this also.
 
well i used FTP and it worked well, i've registered a free FTP to be sure no1 will steal,delete my files, 1 more question, how to resize that image by 70% and compress it abit ?
 
Im not a FTP expert but, cant you place restrictions on the folders? If you can make a new user, and just give it permission to make files, in some folder, and use that user?

And I am sure you can encrypt the username / pw somehow. Never been into enxryption in vb.net, only asp.net, and its very simple there..
 
how to resize that image by 70% and compress it abit ?
calculate 70% of your width/heigth and insert this:
VB.NET:
bmp = bmp.GetThumbnailImage(thumbwidth, thumbheight, Nothing, Nothing)
Png is a lossless compressed image format, I haven't found a way to modify its compression ratio, you can do this with Jpegs.
 
Back
Top