How to upload Corel Draw files in OpenCart? - upload

Customers in my OpenCart store had requested the feature to upload Corel Draw files (.cdr) from product page by using the Upload File option. This is a file type extension that is not supported by default, and I am yet unable to incorporate it. What I've done so far:
In System > Settings > Server, I included cdr and CDR under Allowed File Extensions. Additionally, I've put all the MIME types I could find for Allowed File Mime Types:
application/cdr
application/coreldraw
application/x-cdr
application/x-coreldraw
application/vnd.corel-draw
image/cdr
image/CDR
image/x-cdr
image/x-coreldraw
zz-application/zz-winassoc-cdr
Unfortunately, OpenCart would still return "Invalid Extension Type" when I try to upload a Corel Draw X6 cdr file. I also tried to incorporate .torrent files (using the same approach - just for a test - and it worked), so I believe the answer to uploading .cdr files is close.

If you want to do it via the file manager in the admin backend you could make the following vqmod script and save it in your xml folder... this will allow you to add the cdr files into your site for dowload or for linking or anything via your file manager...
<modification>
<id>CDR File Uploader</id>
<version>1.2</version>
<vqmver>2.1.5</vqmver>
<author>Jeremy Fisk</author>
<file name="admin/controller/common/filemanager.php">
<operation>
<search position="before"><![CDATA[if (isset($this->request->get['image'])) {]]></search>
<add><![CDATA[$ext = strrchr($this->request->get['image'], '.');
if(strtolower($ext) == '.cdr') {
$this->request->get['image'] = 'cdr_icon.png';
}]]></add>
</operation>
<operation>
<search position="after"><![CDATA['.jpg',]]></search>
<add><![CDATA['.cdr',]]></add>
</operation>
<operation error="skip"><!-- 1.5.0.x - 1.5.1.2 only -->
<search position="replace"><![CDATA[$this->model_tool_image->resize(substr($file, strlen(DIR_IMAGE)), 100, 100)]]></search>
<add><![CDATA[(strtolower($ext) == '.cdr') ? $this->model_tool_image->resize('pdf_icon.png', 100, 100) : $this->model_tool_image->resize(substr($file, strlen(DIR_IMAGE)), 100, 100)]]></add>
</operation>
<operation error="skip"><!-- 1.5.1.3 only -->
<search position="replace"><![CDATA[$this->model_tool_image->resize(utf8_substr($file, strlen(DIR_IMAGE)), 100, 100)]]></search>
<add><![CDATA[(strtolower($ext) == '.cdr') ? $this->model_tool_image->resize('pdf_icon.png', 100, 100) : $this->model_tool_image->resize(utf8_substr($file, strlen(DIR_IMAGE)), 100, 100)]]></add>
</operation>
<operation>
<search position="replace"><![CDATA[300000]]></search>
<add><![CDATA[3000000]]></add>
</operation>
<operation>
<search position="after"><![CDATA['image/jpeg',]]></search>
<add><![CDATA[ 'application/octet-stream',]]></add>
</operation>
</file>
<file name="admin/language/english/common/filemanager.php">
<operation>
<search position="replace"><![CDATA[300kb]]></search>
<add><![CDATA[3MB]]></add>
</operation>
</file>
This will also increase your upload limit in the file manager n opencart to 3Mb (used to be 300Kb)
You will need to save a png file of a cdr icon in your default image location (called
"cdr_icon.png")
I hope this little script helps
Cheers
Jeremy

I tried all the above but its not working. The latest OpenCart 1.5.6.x Versions don't allow anything except image files to be uploaded through image manager. "All file Types" extension (its a paid extension) worked. However you need to set correct MIME type of coral files application/cdr

Related

Upload file using Jenkins Active Choices Reactive References plugin

I am using Jenkins Active Choice plugin. I want to provide a file upload function based on reference variable
The below setting allows me to enter text when i select reference parameter scan_type as vulnerability-Web
What i want is , instead of taking text input it should upload file , and content of the file should be assigned to SELENIUM_RECORDED_FILE
I tried using below groovy
if (scan_type.equals("Vulnerability-Web")) {
inputBox = "<body> <form action='upload.php' method='post' enctype='multipart/form-data'> Select file to upload: <input type='file' name='fileToUpload' id='fileToUpload'> </form>"
return inputBox
}
its adding file upload option but the file content is not stored in SELENIUM_RECORDED_FILE
Please let me know how can we achieve this
Reading through HERE, it looks like you must have
<input type="file" name="file">

allow large(r) files to be uploaded

In my Grails app, I have an action that has an uploaded file parameter. The file is retrieved from the request like so:
CommonsMultipartFile cu = params['currencyResult']
It works fine if the file size is small, but if I try and upload a 1.3MB file, a "connection was reset" error occurs (execution never reaches the action).
I've tried making the following changes to allow files up to 100MB to be uploaded. In resources.groovy, I added the following Spring bean
multipartResolver(CommonsMultipartResolver) {
maxUploadSize = 1000000 * 100 // 100 MB
}
In Tomcat's server.xml, I added this maxPostSize attribute to the Connector
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443" maxPostSize="100000000"/>
But still the upload fails for a 1.3MB file. Is there something else I need to configure in order to allow larger files to be uploaded?
Have you looked into setting Tomcat's connectionUploadTimeout and disableUploadTimeout?
From the Documentation:
connectionUploadTimeout
Specifies the timeout, in milliseconds, to use while a data upload is
in progress. This only takes effect if disableUploadTimeout is set to
false.
Example:
<Connector port="80" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="443"
maxPostSize="100000000"
disableUploadTimeout="false"
connectionUploadTimeout="300000" />
Or in development, you can set this in Grails with the following:
eventConfigureTomcat = { tomcat ->
tomcat.connector.setAttribute('disableUploadTimeout', false);
tomcat.connector.setAttribute('connectionUploadTimeout', 300000);
}
You will want to adjust the timeout value according to your needs.
Are you doing this by a WS or POST?
if with WS adjust the
<scripting>
<webServices>
<jsonSerialization maxJsonLength="500000000"/>
</webServices>
</scripting>

ITMSTransporter 'software_screenshots' tag issue

I'm using ITMSTransporter to send xml that updates my app's info in iTunes Connect. I'm having difficulty with software_screenshots tag.
I'm updating existing localization in iTunes Connect (dutch to be exact). That localization has already some info there with defined screenshots.
I do NOT want to update screenshots, but if i use xml that doesn't contain (see below) then all the images in iTunes Connect are wiped out.
Docs says: " Software Screenshots (required on initial delivery of a locale )"
So is it a bug or am i doing something wrong?
<package xmlns="http://apple.com/itunes/importer" version="software5.1">
<metadata_token>14075873352</metadata_token>
<provider>Provider</provider>
<software>
<vendor_id>12345</vendor_id>
<software_metadata>
<versions>
<version string="1.0">
<locales>
<locale name="nl-NL">
<keywords>
<keyword>dutch1</keyword>
<keyword>dutch2</keyword>
<keyword>dutch3</keyword>
</keywords>
<title>Dutch title</title>
<description>dutch desc</description>
<version_whats_new>dutch</version_whats_new>
<support_url>some url</support_url>
<privacy_url/>
</locale>
</locales>
</version>
</versions>
</software_metadata>
</software>
</package>
According to official documentation you have to include all description of files in the section:
<software_screenshots>
<software_screenshot display_target="iOS-3.5-in" position="1">
<size>11630</size>
<file_name>pr_source.png</file_name>
<checksum type="md5">8ccc2a3bb16c4e1c808d5811c0d47b48</checksum>
</software_screenshot>
....
</software_screenshots>
If you include new file in this section or change the checksum, then checksum won't be equal and iTunes connect change or add this file in the position defined in software_screenshot->position. In this way the new files should be in root of folder.
If you doesn't define any description of files, then all files will be removed from the store.
If you don't want to change any files, you will have to describe these files in this section. But you don't want to include these files in the root of folder. The iTunes connect will ignore this files in this way.
I hope it will help you to solve your problem.

Possible to add attributes via NcML to non-cached THREDDS datasets?

For several years on our THREDDS Data Server (TDS) we've been happily using the cache="false" functionality on datasetRoot to tell the TDS not to cache several netcdf files.
<service name="allServices" serviceType="Compound" base="">
<service name="ncdods" serviceType="OpenDAP" base="/thredds/dodsC/"/>
<service name="HTTPServer" serviceType="HTTPServer" base="/thredds/fileServer/"/>
<service name="iso" serviceType="ISO" base="/thredds/iso/"/>
<service name="uddc" serviceType="UDDC" base="/thredds/uddc/"/>
</service>
<datasetRoot path="FVCOM" location="/http/www/CODFISH/Data/FVCOM/" cache="false"/>
<dataset name="NECOFS GOM2 Forecast" ID="gom2_nocache" serviceName="allServices"
urlPath="FVCOM/NECOFS/Forecasts/NECOFS_GOM2_FORECAST.nc" dataType="Grid"/>
The reason we don't want to ever cache these files is that every day these daily forecast files get overwritten with files that have the same name, but different data.
But now we have a need to add and modify the attributes of these datasets. In particular, we would like to add the global attribute
<attribute name="cdm_data_type" value="any"/>
Can we modify attributes via NcML when the dataset to be modified is contained in this kind of datasetRoot construct?

Localization with SSRS

I'm trying to localize a SSRS reports. I have a DLL that uses a ResourceManager to access resource files that are embedded in the dll. My report has a reference to the dll. The dll is signed and strongly named. The dll and resource files' dll are compiled and in MicrosoftVisualStudio9.0/Common7/IDE/PrivateAssemblies and in Microsoft SQL Server\MSRS10.REPORTSERVER\Reporting Services\ReportServer\bin. The resource dll's are also installed in the GAC using gacutil.
Occasionally the SSRS correctly finds the resource key it needs and displays it. However, when changing the resource files to add more key's and values, I cannot get the SSRS to access the newly added files. I have repeated all of the above steps and even uninstalled and installed the resources in the GAC. Still I cannot get it to work.
Any idea what step I'm missing? Clearly the process works, I'm just not repeating something that I need to be.
For those interested in a slightly different approach, you may want to try using a localization assembly that doesn't use the standard resource management, but instead relies on simple file IO. This makes making changes to existing resx files or adding new ones less problematic. You can add or change the resx files and instantly be able to retrieve values for use in the reports. I followed this example, with only minor tweaks and have been very happy with the results:
http://www.codeproject.com/Articles/294636/Localizing-SQL-Server-Reporting-Services-Reports
One note though, the steps to follow when adding the new CodeGroup are lacking a bit in that if you place the new CodeGroup anywhere except after the unnamed UnionCodeGroup (it's the one with the Url="$CodeGen$/*") your attempts to access your custom assembly will fail.
After a lot of digging I was able to find confirmation of this on one of the msdn pages (see the "Placement of CodeGroup Elements for Extensions" section). Their wording was that "it is recommended", but from my testing I'd say it's required, at least when testing directly on the report server:
http://msdn.microsoft.com/en-us/library/ms152828.aspx
The xpath to use in wix for this location in the rssrvpolicy.config file is:
//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]/CodeGroup[\[]#PermissionSetName='ReportLocalization'[\]]
Here's an example of how this can be done in WiX using the util:XmlConfig extension:
<DirectoryRef Id="TARGETDIR">
<Component Id="I18N_RSSRVPOLICY_CONFIG" Guid="some GUID">
<util:XmlConfig
Id="RS_i18n_PermissionSet_remove_if_already_exists"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="delete"
On="install"
ElementPath="//NamedPermissionSets"
VerifyPath="//NamedPermissionSets/PermissionSet[\[]#Name='ReportLocalization'[\]]"
Node="element"
Sequence="100">
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_PermissionSet_add"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="create"
On="install"
ElementPath="//NamedPermissionSets"
VerifyPath="//NamedPermissionSets/PermissionSet[\[]#Name='ReportLocalization'[\]]"
Node="document"
Sequence="101">
<![CDATA[
<PermissionSet class="NamedPermissionSet" version="1" Unrestricted="true" Name="ReportLocalization" Description="A special permission set that allows Execution and Assertion" />
]]>
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_CodeGroup_remove_if_already_exists"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="delete"
On="install"
ElementPath="//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]"
VerifyPath="//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]/CodeGroup[\[]#PermissionSetName='ReportLocalization'[\]]"
Node="element"
Sequence="102">
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_CodeGroup_add"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="create"
On="install"
ElementPath="//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]"
VerifyPath="//PolicyLevel/CodeGroup/CodeGroup[\[]#class='FirstMatchCodeGroup'[\]]/CodeGroup[\[]#PermissionSetName='ReportLocalization'[\]]"
Node="document"
Sequence="103">
<![CDATA[
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="ReportLocalization" Name="Verint.SSRS.Localization" Description="This grants the Verint.SSRS.Localization.dll ReportLocalization Permissions">
<IMembershipCondition class="UrlMembershipCondition" version="1" Url="UPDATE_ME"/>
</CodeGroup>]]>
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_CodeGroup_update"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="create"
On="install"
ElementPath="//IMembershipCondition[\[]#Url='UPDATE_ME'[\]]"
Name="Url"
Value="[SQLREPORTINGSERVICESPATH]ReportServer\bin\Verint.SSRS.Localization.dll"
Node="value"
Sequence="104">
</util:XmlConfig>
<util:XmlConfig
Id="RS_i18n_REDP_CodeGroup_update"
File="[SQLREPORTINGSERVICESPATH]ReportServer\rssrvpolicy.config"
Action="create"
On="install"
ElementPath="//CodeGroup[\[]#Name='Report_Expressions_Default_Permissions'[\]]"
Name="PermissionSetName"
Value="FullTrust"
Node="value"
Sequence="105">
</util:XmlConfig>
</Component>
</DirectoryRef>
I recommend backing up the original config files (with WiX or custom actions). This can make uninstall easier since you can just replace those originals, and also because you can test this over and over again till it's doing what you want. Good luck to you all!
Are your rebuilding and redeploying all the satellite assemblies with each of your updates (including in the GAC)?
If not, it sounds like the problem is due to assembly versioning. There is a SatelliteContractVersion attribute that you can apply to your main assembly to help with this problem. Although rebuilding/resigning/redeploying all satellite assemblies each time you deploy an update may be easier.

Resources