Can I read a spreadsheet directly from a file input? - file-upload

I have a form with an option to upload and process a spreadsheet.
<form method="post" action="">
<input type="file" name="myFile" />
<input type="submit" name="process" value="Process File" />
</form>
On post, I want to read the spreadsheet using a cfspreadsheet action="read". Is there any way to read the spreadsheet directly from the form field, or do I have to upload it first using cffile action="upload" and then read it from the new file location?

Using the following code reads the file directly from the form field / temp folder:
<cfspreadsheet action="read" src="#form.myFile#" sheet="1" />

Related

How to send a SPECIFIC file using a ASPUpload?

I want to send a time.txt by aspUpload (persist) without a form choice.
My code is:
<FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="Up1.asp">
<INPUT multiple TYPE=FILE SIZE=50 NAME="FILE1" id=ARQ accept=".s3dx" onchange="ChangeFile();">
<INPUT TYPE=SUBMIT VALUE="Send Files" id=BT>
</FORM>
But i can to use: FILE = "time.txt"
is it possible?
I never change the file

How to make a download link button for doc files in vuejs

I have a form to edit, upload and download doc files. The form is like this-
The edit form has many input fields. But I am showing only the file fields.
My questions:
How to download available files ? I was given a base url. The base url is - "http://45..........". And my codes are-
Brd Doc
<input
type="file"
ref="softCopy1"
v-on:change="softCopyAttach1"
/>Download<br /><br>
<label for="">Sow Doc</label>
<input
type="file"
ref="softCopy2"
v-on:change="softCopyAttach2"
/>Download<br /><br>
<label for="">Srs Doc</label>
<input
type="file"
ref="softCopy3"
v-on:change="softCopyAttach3"
/>Download<br /><br>
<label for="">Uat Doc</label>
<input
type="file"
ref="softCopy4"
v-on:change="softCopyAttach4"
/>Download<br /><br>
<label for="">Technical Soln</label>
<input
type="file"
ref="softCopy5"
v-on:change="softCopyAttach5"
/>Download<br /><br>
<label for="">Finan break</label>
<input
type="file"
ref="softCopy6"
v-on:change="softCopyAttach6"
/>Download<br /><br>
<label for="">Final finan</label>
<input
type="file"
ref="softCopy7"
v-on:change="softCopyAttach7"
/>Download<br /><br>
</div>
I have included anchor link to get files from backend. So what to write inside to download the file?
Here is a pic of the datas that I am getting from backend using api-
The file keys are- brd_doc, sow_doc and so on.....
My second question is suppose I have inserted a file during create new in key brd_doc. After insertion, when I will edit, I have inserted another file in key sow_doc and kept brd_doc empty. Now the file which I had uploaded during create new in key brd_doc gets deleted. But I want to keep it. How can I do this ?

Insert multiple files into mysql

I am trying to create a form whereby I can select multiple files (they will be pdfs) and insert the file and the file's name into the database.
Html form works beautifully:
<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="files[]" multiple/>
<input type="submit"/>
</form>
But I can't seem to make the php work with it:
if(isset($_POST['files[]'])){
$file_name = $_POST['files[]']['name'];
$file_size =$_POST['files[]']['size'];
$file_type=$_POST['files[]']['type'];}
$query="INSERT INTO upload_data (`FILE_NAME`,`FILE_SIZE`,`FILE_TYPE`) VALUES('$file_name','$file_size','$file_type'); ";
I also don't know how to insert the actual file, as opposed to just its properties. Any ideas?
UPDATE:
I got how to upload multiple files, and also multiple file names, but I cannot do both at the same time. Still need help. The code is:
<form action="" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<input type="file" name="files[]" multiple/>
<input type="submit"/>
</form>
if(isset($_FILES['files'])){
foreach ($_FILES['files']['name'] as $filename) {
$query=mysql_query("INSERT INTO practice (name) VALUES('$filename')", $c) or die("six");
}
}
and
if(isset($_FILES['files'])){
foreach ($_FILES['files'] as $file) {
$query=mysql_query("INSERT INTO practice (file) VALUES('$file')", $c) or die("six");
}
}
To get information about uploaded files, you need to use the $_FILES variable instead of the $_POST variable : http://www.php.net/manual/en/features.file-upload.post-method.php

Using attachFile and Submit

I have the following HTML:
<form action="upload" method="post" enctype="multipart/form-data" >
Select a file to upload:
<input type="file" name="file"/>
<input type="hidden" name="USER_NAME" id="USER_NAME" value="user_name"/>
<input type="submit" value="Submit"/>
</form>
I'm having a couple of problems.
Firstly, in the entry field (named "file") I want to set the name of the file to upload. I can do that just with WebElement.type(), but I get a warning about using attachFile. I'm happy to use that, but when I do so I get the error:
com.thoughtworks.selenium.SeleniumException: Element must be user-editable in order to clear it.
My second problem is that if I set the content of the entry field by type(), the submit button doesn't work. I can get the WebElement by css, but neither click() or submit() works. Nothing happens at all when I do either.
Thanks in advance for any help, and apologies for dumbness.

Google Custom Search with SEO URL

Well i have this search engine into my site
<form action="/apps/search/" name="g_search" id="cse-search-box" method="post">
<input type="hidden" name="cof" value="FORID:11;NB:1" />
<input type="hidden" name="ie" value="utf-8" />
<input type="text" autocomplete="off" name="google_seach" class="search-text" onfocus="searchtext('focus')" onblur="searchtext('blur')" />
<label style="color:#796b6b;float:left;padding:0;">|</label>
<input type="submit" style="float:right;margin-top:3px;cursor:pointer;width:16px;height:16px;background:url(/template/img/main/search-icon.jpg);border:none;" value="" alt="Αναζήτηση" title="Αναζήτηση" />
</form>
Now i want some code to results page.Somehow the post request readed from a file called search.php
This file have access to $_POST[] array..
The file initializes $selector variable (for template use).
What we want to echo into contentarea div must put into $body variable..
Any help?
<?php
$selector="search";
$body="<div id=\"cse-search-form\" style=\"width: 100%;\">Loading</div>";
?>
I have a similar issue, just use GCS code provide by Google as it easy, make sure in the option in GSE you select to visualize the search result on your page and not an Iframe