The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Upload with link
#1
Hey,

Can anybody help me? I am working on an address book and need to add a CV upload to it.

The plan is to upload the cv on the join page and have the upload go into a folder on the server and a link saved in mysql under users so it can get echoed out to a downloadable link.

Also after this project I should have some spare time on my hands, would people be interested in a free dashboard theme?
  Reply
#2
I would check out this solution
http://www.codingcage.com/2014/12/file-u...mysql.html

You can skip all the db config stuff since you already have the userspice classes.

And you can just do your sql queries as outlined in the Documentation-> db class

  Reply
#3
Thank you Mudmin, I did what it said but i get this error http://prntscr.com/ches53 any ideas?

I did the following, I added file etc to the users db

I added this to _join.php
<pre>
Code:
    <div class="col-md-6"> <label>CV</label>
        <input type="file" name="file" />
        <button type="submit" name="btn-upload">upload</button>
    </div>
</pre>


I also tried this at the bottom of validate and join.php
<pre>
Code:
if(isset($_POST['submit']))
{

$file = rand(1000,100000)."-".$_FILES['file']['name'];
    $file_loc = $_FILES['file']['tmp_name'];
$file_size = $_FILES['file']['size'];
$file_type = $_FILES['file']['type'];
$folder="cvs/";

move_uploaded_file($file_loc,$folder.$file);
$sql="INSERT INTO users(file,type,size) VALUES('$file','$file_type','$file_size')";
mysql_query($sql);
}
</pre>

  Reply
#4
Sorry that issue was me.


I added this to Join.php but nothing is uploading and no data to the user db.
http://prntscr.com/chfzwl
  Reply
#5
Sorry Wrong Image
http://prntscr.com/chh4qt
  Reply
#6
Not ignoring you, just haven't had time to address it yet. I'm not THAT familiar with file upload stuff, so it still might take a bit for us to get back to this.
  Reply
#7
the problem with dashboard themes is that many of them require markup changes that stray somewhat from bootstrap, i've just implemented a realy good one but it has meant a complete markup rewrite
  Reply
#8
Haha, took me a while to figure out what theme stuff you were talking about, then checked the first post again.

In UserSpice 5, we are planning to use the CDN version of bootstrap and Font Awesome, and pretty much using bootstrap stylings exclusively. UserSpice 4.1 still has some references to SB-Admin, but we weren't really using any of the built in stuff, so it also has been removed. We feel that makes it easy for us to maintain, but people are welcome to customize their bootstrap themes and such to get different feels. For example, the US 5 stuff I have has a demo website on the front end using the CDN version, while the UserSpice backend is using its own styling for now.
  Reply
#9
Sorry for the late response, I had the apple update issue and spent 5 hours sorting that out and then had a whole tin of gloss spill so it's been hell lol.

Any and all help really would be preheated, If I manage to figure it out ill post back with the how to etc.
  Reply
#10
Ok, I got the file to upload, but now I cant get it to post into into the db (I managed to before but forgot how)

Hopefully you guys can help me.


Code:
if(isset($_POST['btn-upload']))
Code:
{

Code:
$file = rand(1000,100000)."-".$_FILES['file']['name'];
Code:
$file_loc = $_FILES['file']['tmp_name'];
Code:
$file_size = $_FILES['file']['size'];
Code:
$file_type = $_FILES['file']['type'];
Code:
$folder="cvs/";

// new file size in KB
Code:
$new_size = $file_size/1024;
// new file size in KB

// make file name in lower case
Code:
$new_file_name = strtolower($file);
// make file name in lower case

Code:
$final_file=str_replace(' ','-',$new_file_name);

Code:
if(move_uploaded_file($file_loc,$folder.$final_file))
Code:
{
` $sql="INSERT INTO users(file,type,size) VALUES('$final_file','$file_type','$new_size')";
mysql_query($sql);`
Code:
?>
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)