categorize uploaded files - asp.net

I have a webapplication for uploading and showing files(Image and video).The administrator can upload files and the users can view this files.Now i am inserting the details of file to the sqlserver and populating links for the corresponding file in the user's form.There may have images and videos.
I want to categorize the image and
video files;ie ,i want to show files
in two separate folders(Images and
Videos)
.This Categorizing also in sql(there should have a category table and it should be related with fileM table.
If anyone can help me please..
thank you

You need to detect the mime type of the file. Have a look at this question in stackoverflow..
How should I detect the MIME type of an uploaded file in ASP.NET?

Related

how to show images from ftp folder with folder names and images names in asp.net c#

I am beginner in asp.net development. I am creating an web application where I am required to show images from folder along with folder name. Such that one list containing folder names when one folder name is selected its file names are displayed (images names) and also in image viewer images are displayed one by one on button click. then so on for next folders.
Any suggestion, code or useful link will be highly appreciated.
Thanks in advance.
Here is what you want
You can use Jquery tree view with Asp.net
http://www.programmingsolution.net/useful-js/jquery-treeview.php
For jquery try this
http://jquery.bassistance.de/treeview/demo/
Check this ready to use control with lesser effort I suppose. http://www.obout.com/Obout.Ajax.UI/FileManager/

Do aspx/cs files contain meta data?

Do the aspx, aspx.cs, web.config and accdb contain any meta data that can be read when I publish my site? (E.g. the information that can be required by reading out jpeg files).
If yes, how to view/edit this?
P.s. Except the properties shown in windows explorer of course.
Thanks in advance.
Whatever is in your aspx file, that's all what is there.
If you have added some metadata there (usually in the < head>< /head> tags), then it will be there, otherwise not.
The aspx.cs file is never really sent to the webbrowser, so there is no question of it having metadata or not.
aspx.cs web.config files are plain text files with different extensions, they don't contain embedded metadata (data which would describe the content, etc).
As for the .accdb files, you can check this question

Wordpress image name same as page

Friends, i'm stuccoed with images in wordpress - please, help me understand where search for solution.
If you create webpage - www.wordpress.local/page1/01-0001 and you upload an image 01-0001 on that page, you can see, that when you'll visit www.wordpress.local/page1/01-0001, you'll see the page with image, not the page, that you created with text and images.
Any ideas how to solve it ?
PS Not renaming images :)
When you use the WordPress-uploader, the images are stored in /wp-content/uploads/, and WordPress takes care of using filenames that aren't already in use.
If you upload an image, e.g. via FTP, that has the same name as a WordPress-page, the server has to decide what it should serve; either the WordPress-page or the image. One URL = one file served.
In your case, the server decides for the image. You could of course change this configuration; but in all cases, one of the two files won't be accessible.
If you want to make both files accessible, you either need to rename the image or the WordPress-page.

how to store and retrieve images for user articles

I have a web site in which users post news to site.
so i have two field in my database NewsTitle and NewsBody.
The Newsbody can have images.
What datatype should I use for NewsBody?
I don't want images loaded from image hosting site, I want images save in my database or in my web site's host.
What is the best way to implement this, should I use ajaxcontroltoolkit?
any ideas?
You can set your the datatype as varchar as the filename of your image, since all you need to know when you try to display the image is the filename. (but of course, you must already know the location of this file)
I think u can use ListView and the template field will contain asp:image.you can store the image name in the database and bind the imageUrl through the image directory in your system plus the image name.

Uploading and downloading files from a list type

I am using an ASP.NET FileUpload to upload files to the server. How to upload it to the rootfolder of my project. I want to add the files to a collection or list of files to be shown on the webpage in the form of gridview. Each file should have a link to itself in the list So that it could be downloaded by the click-if desired. The gridview will also have a delete column so that I can delete any of the corresponding file-as desired. Can anyone help me to achieve this easily-without javascript or ajax
There are two ways to do it:
Simple way: create a sub-folder where you'll place your files and use DirectoryInfo.EnumerateFiles to list them.
Complex (but better) way: create a sub-folder where you'll save your files, outside of the web site, when a file is uploaded write an entry into a database, specifying the file's name (and maybe some other useful informations, e.g. size, type, etc), in your page you list the database entries, and when a user clicks on one of the links you serve the files through an ASHX handler. This way you have access control on who can download the files, and can track statistics.

Resources