Drupal webform file upload not saving to database - drupal

I'm writing a custom Drupal module for a mobile service. That module acts like a web form, but I'm having a problem when uploading a file. All values are inserted into the database successfully except for the file.

I think the function "_webform_client_form_submit_process" is not calling "_webform_submit_file". You can try following solution
1. Try using updating your webform module with the latest release.
2. Try removing your file upload field from fieldset, if its in any.
3. Check the temp and destination directory permission.

I've almost went over the code of the webform module and I solved it now, you have to use file_save and get the $file->fid and pass it to the data object of the submissions object, then call webform_submission_insert and get the $sid and pass it to file_usage_add, this got my module working

Related

Drupal 8 to publish files

I'm trying to create a simple CMS to ingest contents and publish files. I'm using Drupal 8 with Feeds module to read xml files from a directory and it works fine.
I can't figure it out how I can take the information saved in my custom content and publish them to a file in another directory.
Anyone can help?
Thx
Luca
Could you create a view to render the desired output for the content you're after and then use the Views data export module to export that view into a file?
I note the following:
This module also exposes a drush command that can execute the view and
save its results to a file.
drush views-data-export [view-name] [display-id] [output-file]
If you can do it with Drush you can do it with PHP.
So potentially you could write hooks to manage the export of files based on the activity of the feed. E.g. The hook_ENTITY_TYPE_insert would allow you to perform logic when a node of a particular content type is created.

Demandware - Pipeline not found for current domain

I already made pipeline. Which is working fine. Suddenly it give error like
2015-12-18 02:39:08.091 GMT] ERROR system.core ISH-CORE-2368 Sites-SiteGenesis-Site core Storefront [uuid] [request-id]-0-00 [timestamp] "Error executing pipeline: Hello com.demandware.beehive.core.capi.pipeline.PipelineExecutionException:Pipeline not found (Hello) for current domain (Sites-SiteGenesis-Site)"
Does anybody know how to solve this?
In the event that your pipeline can not be found for the selected domain, please go trough and verify all of the following:
Double check Pipeline-Node naming
Pipeline URLs are generated by their name and your desired entry node, in this scenario, I would expect a file named Hello.xml in you cartridge's pipeline directory, and a start node named Start, would be accessed via {instanceURL}/on/demandware.store/Sites-mySite-Site/Hello-Start
Try and force upload of your cartridges
Occasionally the files on the server will not be updated correctly when a save is made; to force an update, right click your project, click Demandware > Upload Cartridges
Check your Cartridge Path
If you are using a shared instance, or your instance is re-provisioned, you may need to check your cartridge path to be sure your custom cartridge(s) are still there.
Check your Code Versions
Occasionally you may increment / change your code version - if you do, make sure that the path you select in Studio is the one that you have selected in Business Manager.
Tech Support
Should you still have issues following the four steps above, please file a support ticket and the tech-support team will be able to provide you with more assistance.

Sitecore 6.6 Shell Excel Uploader

A sitecore instance was recently upgraded from 6.1 to 6.6. There was an upload command that opened a custom xaml dialog. This had an upload button on it which would open another modal with:
UploadPackageForm.Show(MyConstants.FolderPath, true);
While testing some points of functionality across the site I ran into an error while using this uploader saying that the file being uploaded needs to be a zip file. I'm guessing that somewhere along the way from 6.1 to 6.6 the package uploader was given a check for the file type being uploaded. I've been looking around for dialogs that sitecore comes with that I may be able to use. These look promising:
I can't seem to get the file path from this one although I think I could set a property on args passed into the OnOK event which I will try tomorrow.
Sitecore.Shell.Applications.Install.Dialogs.AddFilesDialog
I'm not sure how I would show this one:
Sitecore.Shell.Applications.Dialogs.Upload
Another option is to try making a custom dialog. Any thoughts and ideas are appreciated.
I had a look around the code that deals with the file explorer (that does not restrict the upload file type) and found this. Might be useful:
public static void UploadToDirectory(string directory)
{
Assert.ArgumentNotNull((object) directory, "directory");
Error.AssertString(directory, "directory", true);
UrlString urlString = new UrlString("/sitecore/shell/Applications/Dialogs/Upload/Upload.aspx");
urlString.Append("di", directory);
Context.ClientPage.ClientResponse.ShowModalDialog(urlString.ToString(), "files:uploaded");
}
This method is in Sitecore.Shell.Framework.Files in Sitecore.Kernel
Is the upload for site visitors or Sitecore users within a Sitecore app? Regardless, the UploadPackageForm, in 6.6, validates that the file is a valid Sitecore package (which is always a ZIP file). 6.1 didn't do this.
DOn't use the AddFilesDialog as that's also within the context of installing a Sitecore app.
I'm not exactly sure what the upload is for but if it's for the rendered site, you should create your own. If it's for a Sitecore app, there are several depending on what you need. There's the FlashUpload (3 types under /sitecore/shell/Applications/FlasUpload), the Media uploads at /sitecore/shell/Applications/Media/Upload****.

Not able to download file name containing 'aspx' character in asp .net

Am developing asp .Net web application.
In one of my aspx file am using file to download using generic handler. Everything works great. But when am testing i felt a strange problem. That, if am uploading a image or document with file name containing aspx character for Eg; aspxphoto as file name.
Uploading doesnt have any any problem but when i try to download it is throwing error in Generic handler file as
Object reference not set to an instance of an object.
Can anyone help me why this problem happends and how can i fix it?
You will not be able to do this. The IIS handler wants to "handle" the ASPX. You should simply not allow it, or if you have to, rename it to .aspx.uploaded or something. If you allowed, it you could open yourself to hacking.
As another option, you may be able to create a virtual that implements ("no processing") - possibly using the HTTP Handler under the virtual and just disabling script / execute permissions (under handler >> Edit Feature Permission >> Script OR under Virtual >> Edit permissions >> Special >> Turn Execute off.
I would not recommend the last, since it will add complexity when migrating between test and live AND for recovery (DR).

How do I download an msi file via an asp.net button?

So, I've created my wonderful winforms app that I want to unleash upon the world, and now I am trying to create a simple website to host some basic information and link to the setup file (msi installer file )....
I have a button on the asp.net page and the setup file setupApp.msi in same folder as the asp.net page. I am currently trying the following:
Response.Redirect("http://./SetupApp.msi");
But this best guess at what to do is not working. Is there something wrong with Mime types here? What do I need to put in the click event to allow users to download this file?
The path you are passing in to the method is not valid (there's no server name called ".").
You can pass in a relative path and it should work fine because ASP.NET will resolve the path:
Response.Redirect("SetupApp.msi")
Or if it's not in the same folder, try one of these:
Response.Redirect("../Downloads/SetupApp.msi")
Response.Redirect("~/SomeFolder/SetupApp.msi")
Keep in mind that you don't necessarily have to do the whole redirect at all. Instead of writing code in an ASPX file you could just have a link to your MSI:
Download my app!

Resources