Unable to render image uploaded within Electron app, built with electron-forge - electron

I have a file uploader for users to store images, which I'm saving content to a folder within the application data directory (app.getPath('userData')). This all works fine.
When I attempt to load the image using a basic image tag, with the src pointing to the correct location within the application data directory, it fails to render.
This only occurs after I've packaged the app using electron-forge (make & package). I've only attempted to make for OS-X (darwin x-64). I'm guessing it has something to do with asar, but I can't seem to get this working. I've attempted to use the file protocol for the image source too.
Any idea how to correctly do this?

I found the easiest way is to serve all content up from a server bound to localhost

Related

How to get absolute path to app in Electron app

I use Electron to build my app.
I want to load data from zip unpack it to folder file and show it to user.
I decompress data and then open window since its html it should work fine.
However i see that app.getAppPath() on dev mode is giving me example path D:\elektron but when i build up path is different D:elektron\resources\app how to solve this ?

Uploaded image can't be saved in to folder and the image can't be view in folder when running web under IIS

I have project to upload image and view image on asp.net. everything work as i expected. i can upload image and saved to my folder then saved the folder to database, then from database i can show or view the image.
Unfortunately, after publishing to IIS and run the web UNDER IIS , image that i uploaded won't saved to folder and also the image that contains on my folder can't be viewed when running web under IIIS.
I tried to search in stackoverflow how to solve it and everyone said it's about permission i have tried option to set the security permission but nothing works
Folder settings:
Subfolder settings:
I suspect it could be perhaps a wrong path as your app is installed under the default web site... I often suggest to alwyAs start from the exact thing that happens to avoid guessing about issues.
Edit: the folder structure is really strange. It seems I have the default web site, created an application root under this web site but your main ScraBoy app volder is still under this folder ??? I believe I installed app one level below what you intended

How do I put content into the iOS Documents folder at compile time, using Xamarin?

I have a data file that I need to include with my app when I distribute it. When loading any files in the app, I prefix the file name with:
Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
This works great for anything I create within the app (and for reading back), like files I download in response to a user action. But I can't for the life of me figure out how to place files there when I build my app in Visual Studio.
I've tried making a "Documents" subdirectory in the special "Resources" folder, but that didn't work (I tried setting the "Build Action" to both BundleResource and Content). When I look at the folder for my app (from using the simulator) I can see that in the "Documents" folder there's all the files I downloaded, but I can't find my data file that I'm trying to bundle ahead of time. I even searched my entire hard drive on the Mac and still couldn't find said data file.
The data file isn't an image, if it matters. Just raw binary data. How do I set it up so that this file goes into the proper documents directory at compile time, so that I can read it using the SpecialFolder.MyDocuments prefix? Thanks.
You can't. You can include files in your app bundle, and then at startup copy them from the bundle into a user folder. But this won't happen automatically.

How to deploy arbitrary resources for React Native with CodePush

I'm using CodePush to deploy the js bundle and a couple of resources to my react-native iOS app. Instead of using the react-native bundler to collect all the static images from my project I have a build step that just copies a folder called "static" into release/assets. But beside the "static" folder I als have other folders in release/assets that contain images and videos wich are use dynamically in the app via uri (e.g. { uri: 'assets/images/myImage.jpg' }). When building the app in XCode I just include the assets folder in the package.
From the CodePush documentation I gather that deploying the release folder should update all my assets. But it doesn't.
I downloaded the xcappdata via XCode and there you can see, that CodePush downloaded everything and stored it in /Library/Application Support/CodePush/[id]/release. But it still doesn't show up in the app.
Any ideas? Do I misunderstand the functionality of CodePush?
As you've seen, when you release a directory to the CodePush server via the CLI, it will round trip the entire contents of it to end-user's devices when they perform an update check/synchronization. That said, just because a file is in that update doesn't mean it will be useable unfortunately.
The behavior that you're seeing is actually a limitation of the way that the Image component resolves URIs in React Native. If you use the assets system to specify the "source" property (via a require("image.png") call), it will look for that file relative to the currently running JS bundle. This is how CodePush allows updating images, because as long as our plugin places the "assets" folder next to the JS bundle file on disk, the <Image> component will naturally find them.
However, when you specify an object with a URI (as you're doing) as the value of the "source" property, the Image component looks for that file relative to the binary on disk, and therefore, it will never look for it where it was placed by CodePush when you update them.
Because of this, CodePush only supports updating images which are loading via the require syntax. I'll make sure to update our docs to clarify that. Apologies for the confusion!

Using Backload to upload image to project file but images do not appear until project is rebuilt

Using MVC 4 I downloaded Blackcity Backload from nuget, I am trying to save the uploaded images to a file that is within my project. Everything works great and it shows that the image uploaded, except for the fact that after you upload a new image, and refresh the page the image does not appear in the list of returned images even though it was saved. Also if you delete a file it comes off the list at first but again if you refresh the page it is back. If you rebuild the application then everything appears as it should and the images in the backload file list are all listed correctly and they match what is in the actual file.
I thought it may be a server cache issue but I did all i can to prevent the server from caching and still same problem.
I think it may have to do with the fact that Backloader is dynamically creating folders to put the images in and they are not included in the project even though they are in the file structure. So since they are not part of the project they are not being returned in the get request. Its not until you rebuild that they are recognized as part of the project.
Is there a way to dynamically include new files in the project without rebuilding?
Please help. This is killing me.
Ok this is solved. Had to remove filters.Add(new AuthorizeAttribute()) from my global filters and then add [Authorize] to each controller and it worked.

Resources