Server Images into table

Server Images into table

  
Hi,

I have the following situation: The customer uploads images via FTP to a directory on the application server.

I want to read these images and put them in a table.
What is the best way to archieve this?

Regards,
Hans
Hi Hans,

For reading the images from the file system, you can use the FileSystem extension (available at Solutions, here). Directory_ListDirFiles is a good candidate for retrieving the list of files in your local directory, as well as File_ReadBinary for reading each file.

The web server will need access permissions to handle the files (I believe NETWORK_SERVICE should have permissions to the directory).

For saving the image into the database, you'll have to create an entity with an attribute of type Binary Data, which will hold the content of the file.

Paulo Ramos
I am not sure how to set the permission settings on the server.
Can anyone tell me what or who needs access to the specific directory?
Hi Hans,

1. Right-click the directory, click Properties.
2. Click on tab Security.
3. Click Add...
4. If available, click Locations and select your server, pressing OK.
5. Enter NETWORK SERVICE and press OK *or...*
6. Click Advanced, and press Find Now.
7. Select NETWORK SERVICE from the list.

(This may be different depending on your operating system version.)
We followed the steps and added all the authorization to 'networkservice'.
Then I tested this with the FileSystem Extension Sample.

When I fill in the 'path to read from' I still get an "access denied" error.
Hi Hans,

(assuming Windows Server 2003...)

I think you only need to select the appropriate folder, right click Sharing and Security and add the ASP.NET Machine Account (local server account, not the domain one...) with Read and List Folder Contents privileges.

And if, for security reasons, you don't want other asp.net web applications also reading and accessing those files, you can create a specific user belonging to the IIS_WPG group (similar to ASP.NET Machine Account), repeat the steps above for this user, and finally change your eSpace runtime credentials (Service Center... Run As...; don't forget you need to publish it again).

Alternatively, or if you don't have administration privileges to access your server to complete this task, you can also get your files by FTP. There's also an extension for that... :)

The first alternative would be more appropriated.

Best regards,

Duarte Gouveia
Thanx for the answers!

I works now, the server needed some time to digest the changes :)

I will also checkout the FTP extension maybe I can put it to some use ;)
Hi Hans,

Did you check all the required options in Securiry tab for the account?
It's possible you'll need to specify a different account on your case (try IUSR_MachineName, ASPNET - you can revert the changes later).

As a last resort, you can try to audit the error, in an attempt to pinpoint the account. Go to Administrative Tools, Local Security Policy, and expand Local Policies > Audit Policy. Double-click Audit Object Access and select the Failure checkbox (see more here). These events should later be available through Event Viewer.

Paulo Ramos
Concurrent posting. :)
I'm glad your problem is solved.