web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

File upload from local machine (by having the path only)

(0) ShareShare
ReportReport
Posted on by 737

I have a custom form, and on this form, there is “File name” field, where User can specify the path to the file, located on his local machine.

Also, there is a button “Download” on this form, which should upload the file (which is specified in the “File name” field).

When I try to read the file by using -

var readerStream = new System.IO.StreamReader(catalogVersion.Filename);

the file searching and reading is executed on the server machine (not from User’s local machine).

There is a standard FileUpload control, which I can’t use, since this file is used for many purposes (not only for Import), but and for mapping/settlement with other fields from other tables (so I would need to download this file every time when form is opened, which is ridicules).

So, the question is – how I can “read” the file, if I have the path to this file, which is located on the local machine?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    D365fF&O is executing code server-side, so obviously you are handling files incorrectly if you expect it to work directly from a client folder through a web browser. Think about it, that would be a serious security issue then for web browsers, if any website could just access local content.

    Have a look at these articles:

    [View:http://dev.goshoom.net/en/2016/03/file-upload-and-download-in-ax-7/:750:50]

    [View:https://sertandev.wordpress.com/2017/02/07/how-to-work-with-files-in-ax-7-part-1-upload-download-reading-and-storing-files-in-db/:750:50]

  • Ragoza Oleksandr Profile Picture
    737 on at

    HI Vilmos,

    Thank you for quick replay.

    Information that you provided is familiar to me, but once again thank you.

    The specificity of my task is that User (which will click the “Upload” button) will not select the file in a File Explorer, the system will look into some table field, which contain the path to the desired file.

    So I need “read” (Upload) the file , without selecting the file in File Explorer

  • Vilmos Kintera Profile Picture
    46,149 on at

    Again, I do not think that is technically feasible due to the above security concerns. File access from a browser should have user interaction, unless you use some specific browser add-ons or hooks.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans