Friday, 17 September 2021

Axios POST not working for image upload

I found that this guy had also $_FILES['image'][tmp_name] empty issue:

https://stackoverflow.com/questions/62604318/files-is-empty-when-sending-a-post-request-using-axios-in-reactjs

In my case, it was 2MB upload_max_filesize in php.ini. Please see PHP - empty $_POST and $_FILES - when uploading larger files I pulled out my hair for 2 hours. Nothing wrong with Axios. I didn't need to specify headers.















Thursday, 16 September 2021

Sunday, 29 August 2021

Image Uploader - React

I'm trying  to upload image with React. Source code copied from:

https://www.geeksforgeeks.org/file-uploading-in-react-js/

Image upload required post API call eg, App.js#line39

axios.post("http://localhost:8000/api/imageupload", formData).then(resp => {
console.log(resp.data);
});

API is Lumen. Source code is named scr-webservice.

  • source code directory: ~/my/scr-webservice.
  • source code tool: phpstorm
  • url: http://localhost:8000/
  • Database is currently (29/8/21) pointing to winhost by ~/my/scr-webservice/.env
  • database tool: phpstorm


Post call:

http://localhost:8000/api/imageupload


There is a very good video of image upload using React.js:

https://www.youtube.com/watch?v=XeiOnkEI7XI

Talks about axios post call at video 4:20, but using Firebase, which takes another learning time.

Found another good site talking about React and Lumen connection:



Made it work to return result from API call.





I could xdebug as well. But only from Postman. I couldn't make XDebug work ...
  • From: react website localhost:3000
  • To: API localhost:8000 (LUmen)





XDEBUG from react site to API code didn't work. (in spite of correct settings)




Image passed from Postman.


Saved in uploads folder. and shows correctly!











Tuesday, 24 August 2021

Git cloning in another machine

 I wanted to update scr-webservice code to test uploading images.

The Github repository was created under my matthewoh93 google account.

When I tried to git clone the repo in my dell ubuntu laptop, it was giving below error.



This is because my dell laptop has ssh key bound to matthew.oh@executestrategy.net account.

I tried to add the ssh key into my github, but it didn't work. It returned that 'Key exists already' error.


I don't know what it means, but basically, the ssh key in the machine (matthew.oh@exec) cannot be used in this case (matthewoh93@gmail).

The only solution was inviting matthew.oh@exec into my personal account as collaborator.

The menu is somewhere collaborator invite etc ...

YOu get email invitation.


Accept it. Run git clone again. Voila, it worked.



Now you run lumen. But have errors because other dependencies not installed.



RUn composer install and you get all files. Voila again, Lumen web API is working on your new machine!





Sunday, 26 July 2020

Email manager setup.exe 64bit

How to make setup.exe 64bit

https://www.youtube.com/watch?v=2jdH85teO5Q

Download HxD hex editor
https://download.cnet.com/HxD-Hex-Editor/3000-2352_4-10891068.html

How to create setup.exe in VS 2017



Errors
Unable to find manifest signing certificate in the certificate store
>> Just untick the signing,
https://stackoverflow.com/questions/11957295/unable-to-find-manifest-signing-certificate-in-the-certificate-store-even-wh

https://stackoverflow.com/questions/4517440/why-am-i-getting-unable-to-find-manifest-signing-certificate-in-the-certificate/8117025


Outlook.mailitem is not found
Reference >> Assesmlies >>
Microsoft.office.interop.outlook 15.0

Typ 'PDDocument' is not defined
Below 3 files deleted & re-referenced:

  • PDFBox-0.7.3
  • IKVM.GNU.Classpath
  • IKVM.Runtime




Ignored


Above needs fix.

App.config had the following.
      <add name="AccessConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=M:\db2000.mdb;User Id=admin;Password=;" />

Current Jet.OLEDB does not work in 64bit:
https://social.msdn.microsoft.com/Forums/vstudio/en-US/cfb9efe8-4de2-40b6-b817-553c91b9f9c6/the-microsoftjetoledb40-provider-is-not-registered-on-the-local-machine?forum=csharpgeneral

1. You need to use ACE.OLEDB in App.config
    <add name="AccessConnectionString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=M:\db2000.mdb;Persist Security Info=False;" />

2. You need to install Access database engine 64bit.



Access connection string
https://www.connectionstrings.com/access/




If you try to install different version (64bit) of Access Database Engine on top of MS office 365 (32bit):





System.TypeLoadException: 'Could not load type 'ADODB.FieldsToInternalFieldsMarshaler' from assembly

https://stackoverflow.com/questions/5666265/adodbcould-not-load-type-adodb-fieldstointernalfieldsmarshaler-from-assembly


The INSERT INTO statement contains the following unknown field name: 'Comments'
 INSERT INTO tblItemsHistory (WorkOrderID, OrderVersion, ItemCode,Description,Quantity,Location,SOC, QuantityInt, Comments, CancelledItem)  VALUES ('103225189/70',  '1',  'KIT03',  'KITCHEN REPL ( 3 BED)',  '1.000 EA',  'Kitchen',  'KIT03', 1,  'Kitchen Replacement 600mm Benchtop 3 Bedroom tenant happy for pantry to go in lounge room
',False)


  • tblItem
  • tblItemHistory 

required fields:

  • Comments
  • CancelledItem



TEST

- Test if current Email Manager (32bit) works in my machine (64bit) office (32bit)
>> works

- Test if new Email Manager (64bit) works in my machine (64bit) office (64bit)
>> works


To chase up with Sonya

- Can you show me email server? (it's hard to read email from Outlook because version changes every time, and settings change. If I can read email directly from email server, it will be better)



Friday, 24 July 2020

How to generate SSL Certificate


  1. go to winhost
  2. SSL Manager
  3. Click green button, 'Generate a new CSR'. This will generate CSR (Certificate s? Request)
  4. Copy CSR

  1. Go to namecheap.com
  2. Product List
  3. Click 'Issue new CSR button'
  4. Paste CSR
  5. Generate
  6. DCV(Domain Control Validation) email is sent to podmaster@dolsoft.com.au

  1. Go to winhost >> Email
  2. Click link in the email
  3. Paste the password given in the email
  4. They will send you another email with attached SSL Certificate.zip
  5. Send the zip file to winhost to install.

How can I check if installed properly?
Winhost >> SSL Cert button on top
Namecheap >> Domain list >> Postive SSL Certificate >> it shows 'Active' (not under progress)

Thursday, 23 July 2020

Email Manager 20101110 V6


How to install Email Manager. 
Updated 2020-07-23

1. Download the latest zip file

2. Run setup.exe

3. Create folder C:\EmailManager and copy some setting files in there.

4. Make sure M drive is connected to have db2000.mdb.


Refer below when errors:

- Logged in the new computer and confirmed Access 2019 version
Microsoft 365 MSO (16.0.13) 64-bit

- Fixed Access 64 bit issue

- Changed Non-Unicode system locale to ‘Korean’ to fix Access ActiveX etc error. 

- Changed Y drive to M drive to make EmailManager work

- Installed EmailManager on PC (shortcut is pinned in Start button).

- Created C:\EmailManager folder to make EmailManager work

- Changed PC Date/Time to AU to avoid EmailManager error.
Region >> Formats >> English (Australia)
Region >> Location >> Australia

- I ran Email Manager and confirmed working, but with no work order emails to process.