Upload image or files to folder in local server [closed] - c#

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
How I can upload image or files to folder in local server C# Windows application? I prefer this method instead of saving the images to the database because it makes heavy.
I am using Windows Server 2008, please help me to get articles or tutorials to accomplish this.

The best way, IMO, would be to use FTP. See here for an example of how to do that.
Note, that you will need a good FTP server running on your server computer (I, personally, like FileZilla.
ANOTHER (likely easier) way would be to use SMB. You would have to open up a SMB share on the server for the folder which you want to upload the image too. this question has some example code of how you upload a file using SMB.

I do not advise saving images to the database. Make a directory folder somewhere named images, place your images there. You can save the image paths and names to the database, or hard code them if they aren't going to change.
It's easy to manage that way, less unnecessary database connections as well.
You can use an FTP or place the images directly in the folder on your server.
Here is some helpful reading for you:
Storing Images in DB - Yea or Nay?
storing images in database or on hard drive

Related

how can I save and load information in a desktop inventory application C#? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Im developing this desktop app for study reasons
but im using SQL Server for database management so reading around the web i find some articles on this and why it is bad practice, i cannot move my entire project to another PC without installing SQL Server. then i find this:
Save and load inventory
So i don't know what method of saving and loading information I need for this project, I think in SQL Lite or maybe I can use a simple file to save all the information like the mentioned post.
Im using a DB with relationships and i dont know if i can made it with a data persistence file. What should I do? what is the best practice?
PD: Sorry for my bad english
Usually your SQL Server would be hosted on a remote computer when used outside development, but it depends on exactly what your application is supposed to do.
If it's a requirement for you to be able to switch computers, and not host your database on a remote server, I'd say using SQLite is a good choice.
Alternatively, you could have 1 big file that has all your data instead of a relational database, although I wouldn't really recommend it. It's good for quick prototyping of things, but all your data would be denormalized, which can end up being more effort to work with than SQL. This is what the inventory example you linked does.
If you are planing to move your application on different computers and don't want to install any database management system there then SQLite is the best option.
All of your data will be stored in one file and you can freely move your application an other PC without installing any database management system there.
Here is good article explaining that in which scenarios SQLite is good choice.

How can I copy files from filepath mentioned in cells in excel in my server using c#? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am trying to build a bulk upload functionality on an ASP .NET page. this is required to upload questions and answers in a SQL table. There can be images as well in the question and the answers. For those images, the path to image can be specified.
Is it possible to copy the images from end user's machine to the server and then move these images into the SQL database?
"Is it possible to copy the images from end user's machine to the
server"
Not unless you provide a file input control explicitly on the page and the user puts the necessary file(s) into that control and they get uploaded along with your other data.
Your server does not have access to the user's machine. In fact it almost certainly doesn't even know exactly which machine the request came from. It certainly doesn't have access to any of its disk drives, unless the machine has its own specific public IP address and appallingly lax firewall and security settings.
In fact even your webpage, when it's rendered in the user's browser - which is on their machine - doesn't have access to the disk (think of the implications if a webpage could randomly read files from your disk!) except via a file upload control where the user has to specifically choose which files to send to the server.

IIS Deploy asp.net application [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I have hosted asp.net application on windows 7 64-bit operating system (IIS 6.0).
The problem is I am able to browse some pages of the application while other pages are not opening. Browser response is:
This webpage is not available
These specific pages are using some .pdf files folder and a *.txt file to read and write which are in root directory of application.
Is there anybody that knows what is the thing that I have missed during deployment?
It is like when I hit one page
1) http://xxx.xx.xx.xxx/page1.aspx (webpage working file).
This page reads some gmail inbox and displays result after some manipulation.
2) http://xxx.xx.xx.xxx/page2.aspx (webpage not available).
Second page in same directory does not working. This page is reading/writing some *.pdf files and *.txt files.
Timeout is not problem here.
In your comments you mention transferring to a new host.
There are several possibilities depending on what you are actually doing.
Security. Generally speaking, writing files to the root of your web app is a very bad security issue. If the system is properly configured on the new host then that is likely killing your pages. Actually, writing files anywhere is generally a bad idea unless you have taken the time to configure it and know what you are doing.
PDF/TXT file delivery. The IIS server needs to have it's mime types properly configured in order to deliver those types of files to the browser. If you are linking directly to a file with a .pdf or .txt extension and having a problem then the server might be misconfigured for those.
The best thing to do would be to change your web.config file so that it will give you the actual error message. You can do this by changing the customErrors element to have mode=Off
Note that you might also have to configure your browser to turn off "friendly http errors" if using IE for browsing.
use proper/correct activeX for displaying the PDF (Adobe comes with a free Active X dll (even for Reader) called AcroPDF.dll)

Save image in database directly or to save image path? SQL SERVER [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am using C# .NET v3.5, SQL SERVER 2008. My team is creating Point Of Sale Windows Application for Restaurant and Super Markets, so there will be a huge amount of pictures in the application. For which, I want to know which will be better in terms of responsiveness, saving the images directly in database or to save image paths in the database.
I'll appreciate your response.
Thank you!
Sarmad Asif
As of me Save Image in paths will be better.
I already gone through these phase. We develop Jewellery Software in which we also have huge amount of image. We first store image in DB but then its very difficult to do daily backups as well as restore once size grows. We tried our level best with SQL2008 to take backup without FileStream and try to restore it but we didn't succeed. And last we have changed our logic for image should show from Path.
Better to save image paths in the database and retrieve the path from db and take the image from the responsive paths.
If the you have small images then use Varbinary, otherwise use FileStream.
see this:
https://www.google.com/#q=sql%20server%20filestream%20vs%20varbinary
This is a good book will really help you:
http://download.red-gate.com/ebooks/SQL/Art_of_SS_Filestream_Sebastian_and_Aelterman.pdf
http://technet.microsoft.com/en-us/library/bb933993(v=sql.105).aspx

I want to synchronize my local folder with FTP folder via C# [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
I'm uploading files into FTP using this code:
http://msdn.microsoft.com/en-us/library/ms229715.aspx.
It's all good, but I think using this synchronizing two folders will be not so comfortable.
My FTP directory tree is: /categories/ => /category1, /category2, /category3 and there are tons of files : )
On my local HDD my directory tree is the same, but there are only few files in these folders. Task for my script will be checking if particular file exists on FTP server in the same location, if not, upload it. That's it.
Can you suggest me solution or direction which should I go to?
You could rethink your design a bit. Instead of only comparing the file and folder structures you can use the eventhandler FileSystemWatcher and "sync" (ie upload to ftp) files directly when created.
FileSystemWatcher Events

Categories