I'm trying to save uploaded images to the Image folder in Visual Studio. I can successfully saved the image in the folder but I is not showing when I recall it again because it saved as unused in the folder, so I have to right click on the
image and select include in the project then it show when I recall it again.
I'm trying to save uploaded images to the Image folder in Visual Studio. I can successfully saved the image in the folder but I is not showing when I recall it again because it saved as unused in the folder, so I have to right click on the image and select
include in the project then it show when I recall it again.
Just click the "show all files" toolbar bar in solution explorer if you wish to view file that are not part of the project. Otherwise just open the folder in Windows Explorer.
That's what I did but the application is run on the server and I need to stop the application and click on show all file then click on the image and select include in the project. and that procedure is not making any sense when project run on server.
I do not understand the problem you are trying to solve. Why are you including uploaded files in your solution? Makes no sense.
because the don't allowed me to save it in the database. Do you have another idea ?
Huh? Your original question asks about adding a file to a Visual Studio solution. I assumed, probably incorrectly, that you were testing file upload on your dev machine and could not see the files in Solution Explorer. The fix is simply showing all files
not only project files or opening the folder in Windows Explorer.
If the application is deployed then obviously you cannot see the uploaded files on your dev machine because they are on the server. If you want to see the file then you have to either enable directory browsing in IIS or have access to the server and open
the folder. You can also create a simple action that returns the file names.
Can you explain the following comment, "because the don't allowed me to save it in the database." How does having a database solve this issue?
I can save the uploaded image as binary to the database instead of save it in the Image folder in solution explorer of the project
You did not answer the question. How does a saving a file in a database solve this programming problem? Are you trying to share the files between your development machine and web server?
Luay20032003, this is a support forum we can only work with the code and information you provide. With that being said, I have to make another assumption that these files are part of the application logic. Like user profile pictures. the picture goes
with the user image. My other assumption is you want the dev environment to always be a copy of the production environment. While this is an unusual request it is possible but we need more information.
One solution is to contact your system admin and ask for assistance creating a network share that points to the folder(s) on the web server. If that is not possible then you might be able to get images using a standard HTTP request. This works if the files
are not part of the C# code and just referenced by the src= attribute.
Lastly, most every dev shop has different environments. Some shops have a simple Software Development Life Cycle (SDLC) process with just dev and prod while others have dev, test, staging, and production. Commonly, when you want a copy of production, the
production files are copied to the environment that needs the files. This is usually done because troubleshooting or testing. Typically the dev environment is turbulent and has a lot testing data.
Anyway, your question, as far as I can tell, has nothing to do with MVC. Meet with your peers or senior developers and ask them to help you understand the current SDLC or craft a solution that works for your project.
Member
30 Points
143 Posts
Save image in image folder
Nov 16, 2020 07:51 PM|luay20032003|LINK
this is my code of saving image in image folder.
All-Star
53091 Points
23659 Posts
Re: Save image in image folder
Nov 16, 2020 08:02 PM|mgebhard|LINK
Just click the "show all files" toolbar bar in solution explorer if you wish to view file that are not part of the project. Otherwise just open the folder in Windows Explorer.
Member
30 Points
143 Posts
Re: Save image in image folder
Nov 16, 2020 08:11 PM|luay20032003|LINK
NA
All-Star
53091 Points
23659 Posts
Re: Save image in image folder
Nov 16, 2020 08:25 PM|mgebhard|LINK
I do not understand the problem you are trying to solve. Why are you including uploaded files in your solution? Makes no sense.
Member
30 Points
143 Posts
Re: Save image in image folder
Nov 16, 2020 08:54 PM|luay20032003|LINK
because the don't allowed me to save it in the database. Do you have another idea ?
All-Star
53091 Points
23659 Posts
Re: Save image in image folder
Nov 16, 2020 09:29 PM|mgebhard|LINK
Huh? Your original question asks about adding a file to a Visual Studio solution. I assumed, probably incorrectly, that you were testing file upload on your dev machine and could not see the files in Solution Explorer. The fix is simply showing all files not only project files or opening the folder in Windows Explorer.
If the application is deployed then obviously you cannot see the uploaded files on your dev machine because they are on the server. If you want to see the file then you have to either enable directory browsing in IIS or have access to the server and open the folder. You can also create a simple action that returns the file names.
Can you explain the following comment, "because the don't allowed me to save it in the database." How does having a database solve this issue?
Member
30 Points
143 Posts
Re: Save image in image folder
Nov 16, 2020 11:37 PM|luay20032003|LINK
I can save the uploaded image as binary to the database instead of save it in the Image folder in solution explorer of the project.
All-Star
53091 Points
23659 Posts
Re: Save image in image folder
Nov 17, 2020 11:55 AM|mgebhard|LINK
You did not answer the question. How does a saving a file in a database solve this programming problem? Are you trying to share the files between your development machine and web server?
Member
30 Points
143 Posts
Re: Save image in image folder
Nov 17, 2020 01:37 PM|luay20032003|LINK
Yes.
All-Star
53091 Points
23659 Posts
Re: Save image in image folder
Nov 17, 2020 02:57 PM|mgebhard|LINK
Luay20032003, this is a support forum we can only work with the code and information you provide. With that being said, I have to make another assumption that these files are part of the application logic. Like user profile pictures. the picture goes with the user image. My other assumption is you want the dev environment to always be a copy of the production environment. While this is an unusual request it is possible but we need more information.
One solution is to contact your system admin and ask for assistance creating a network share that points to the folder(s) on the web server. If that is not possible then you might be able to get images using a standard HTTP request. This works if the files are not part of the C# code and just referenced by the src= attribute.
Lastly, most every dev shop has different environments. Some shops have a simple Software Development Life Cycle (SDLC) process with just dev and prod while others have dev, test, staging, and production. Commonly, when you want a copy of production, the production files are copied to the environment that needs the files. This is usually done because troubleshooting or testing. Typically the dev environment is turbulent and has a lot testing data.
Anyway, your question, as far as I can tell, has nothing to do with MVC. Meet with your peers or senior developers and ask them to help you understand the current SDLC or craft a solution that works for your project.